perf: IC hit/miss 路径 depth=0 快速路径内联,跳过 proto 遍历函数调用

This commit is contained in:
2026-06-30 23:45:52 +08:00
parent 168ef93079
commit 969eacb047
3 changed files with 52 additions and 18 deletions
+13
View File
@@ -87,6 +87,12 @@ pub(crate) fn ic_get_hit(obj: &JsObject, shape_id: u32, slot_index: u32, proto_d
if shape_id == 0 {
return None;
}
if proto_depth == 0 {
if obj.shape_id() == shape_id && slot_index < obj.prop_vec_len() as u32 {
return Some(obj.get_prop_at(slot_index));
}
return None;
}
let target = resolve_proto_target_raw(obj as *const JsObject, proto_depth);
if target.is_null() {
return None;
@@ -104,6 +110,13 @@ pub(crate) fn ic_set_hit(obj: &mut JsObject, shape_id: u32, slot_index: u32, pro
if shape_id == 0 {
return false;
}
if proto_depth == 0 {
if obj.shape_id() == shape_id && slot_index < obj.prop_vec_len() as u32 {
obj.set_prop_at(slot_index, value);
return true;
}
return false;
}
let target = resolve_proto_target_raw(obj as *const JsObject, proto_depth);
if target.is_null() {
return false;