mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
fix: 返回清空 sloppy 函数 arguments 属性,末次 arguments 对象不再保活晋升
dispatch_create_arguments 把 sloppy 函数的 own arguments 数据属性设为本调用的 arguments 对象,调用返回后从不清除,强引用保活最后一次调用的 arguments 对象, 跨 epoch 晋升后泄漏(object_graph_retention_anchor 32770 vs 32769)。 restore_frame 弹帧时按 sloppy 且属性在场清空该属性(置 undefined),与 V8 对 非执行中函数 func.arguments 返回 undefined 的语义对齐;strict 函数无 own arguments,不涉及。
This commit is contained in:
@@ -533,6 +533,18 @@ impl Vm {
|
|||||||
frame.return_addr,
|
frame.return_addr,
|
||||||
frame.caller_reg_limit
|
frame.caller_reg_limit
|
||||||
);
|
);
|
||||||
|
// 调用返回:sloppy 函数在 dispatch_create_arguments 把 own arguments 属性
|
||||||
|
// 设为本调用的 arguments 对象;返回后须清空(置 undefined),否则强引用
|
||||||
|
// 保活最后一次调用的 arguments 对象,跨 epoch 晋升后泄漏。仅当属性在场时
|
||||||
|
// 清空(strict 函数无 own arguments,避免误建)。
|
||||||
|
if !frame.strict && frame.callee.is_object() {
|
||||||
|
let arguments_si = self.kernel_core.perm_interner().intern("arguments").0;
|
||||||
|
let callee_ref = unsafe { &*frame.callee.as_js_object_ptr() };
|
||||||
|
if let Some(slot) = self.get_own_property_slot(callee_ref, arguments_si) {
|
||||||
|
let callee_mut = unsafe { &mut *frame.callee.as_js_object_ptr() };
|
||||||
|
callee_mut.set_prop_at(slot, JsValue::undefined());
|
||||||
|
}
|
||||||
|
}
|
||||||
// 弹帧后 callee 换回调用方:失效 upvalue 切片缓存。
|
// 弹帧后 callee 换回调用方:失效 upvalue 切片缓存。
|
||||||
self.upvalue_cache = None;
|
self.upvalue_cache = None;
|
||||||
if let Some(saved_bc) = self.saved_bytecode_stack.pop() {
|
if let Some(saved_bc) = self.saved_bytecode_stack.pop() {
|
||||||
|
|||||||
Reference in New Issue
Block a user