refactor: 字符串值改用 JsString 指针表示,键与字面量改用 PermInterner

This commit is contained in:
2026-06-24 20:15:15 +08:00
parent 9a62cf1610
commit ddffa8504e
73 changed files with 768 additions and 860 deletions
+5 -5
View File
@@ -110,12 +110,12 @@ impl Vm {
let prop_val = self.coerce_primitive_bounded(prop_raw, false)?;
let rhs = self.coerce_primitive_bounded(self.regs[a], false)?;
let new_val = if prop_val.is_string() || rhs.is_string() {
let ls = coercion::to_string(self.kernel_core.string_forge().as_ref(), prop_val);
let rs = coercion::to_string(self.kernel_core.string_forge().as_ref(), rhs);
self.intern(&format!("{ls}{rs}"))
let ls = coercion::to_string(prop_val);
let rs = coercion::to_string(rhs);
self.new_string(&format!("{ls}{rs}"))
} else {
let ln = coercion::to_number(prop_val, self.kernel_core.string_forge().as_ref());
let rn = coercion::to_number(rhs, self.kernel_core.string_forge().as_ref());
let ln = coercion::to_number(prop_val);
let rn = coercion::to_number(rhs);
JsValue::float(ln + rn)
};
let obj = unsafe { &mut *obj_ptr };