mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 11:11:11 +08:00
perf: IC hit/miss 路径 depth=0 快速路径内联,跳过 proto 遍历函数调用
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user