refactor: 扁平化对象属性存储并优化常量池与 IC 热路径

This commit is contained in:
爱特每羊队
2026-06-13 23:59:47 +08:00
parent dcc7db2575
commit bf74adf7f5
26 changed files with 307 additions and 87 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ pub fn bind_number(kernel: &Arc<OxideKernel>, global: &mut JsObject) {
let num_shape = kernel.shape_forge().make_shape(global.shape_id(), si_num);
let num_val = JsValue::from_js_object(kernel.builtin_world().number_constructor.as_ptr() as *mut JsObject);
global.set_shape_id(num_shape);
global.ensure_hash_props().push(Box::new(num_val));
global.ensure_hash_props().push(num_val);
global.bump_generation();
{
@@ -52,7 +52,7 @@ pub fn bind_number(kernel: &Arc<OxideKernel>, global: &mut JsObject) {
("NEGATIVE_INFINITY", JsValue::float(f64::NEG_INFINITY)),
("POSITIVE_INFINITY", JsValue::float(f64::INFINITY)),
] {
num_ctor.ensure_hash_props().push(Box::new(value));
num_ctor.ensure_hash_props().push(value);
let prop_si = kernel.string_forge().intern(name).0;
let next_shape = kernel.shape_forge().make_shape(num_ctor.shape_id(), prop_si);
num_ctor.set_shape_id(next_shape);