perf: 字节码调用压帧窗口按调用点存活上界拷贝减少整窗搬移

RegAlloc 改写后补第三次 liveness,为每条 CALL/NEW/SUPER_CALL 计算调用点
存活上界(最大存活物理槽号 + 1,254/255 由帧单独保存不计入),编码进
ext 高 8 位(nargs 低 8 位不变)。三处手写压帧窗口 = min(调用方活动寄存
器, 存活上界),restore_frame 按窗口回拷;CallFrame 新增
caller_active_reg_limit 保存调用方真实活动上限,恢复时不随截断窗口缩水。
生成器/异步函数体调用点保持全量窗口。spread 调用与运行时发起压帧
(accessor/内联)走全量路径不受影响。
This commit is contained in:
2026-08-15 09:56:22 +08:00
parent ff129d626f
commit 2239eeac24
13 changed files with 448 additions and 11 deletions
+12 -2
View File
@@ -202,7 +202,16 @@ impl Vm {
self.saved_immutables_stack.clear();
self.cell_stack.clear();
self.inline_callee = None;
self.push_bytecode_frame(callee, this_value, args, None, None, JsValue::undefined(), FrameContinuation::None)
self.push_bytecode_frame(
callee,
this_value,
args,
None,
None,
JsValue::undefined(),
FrameContinuation::None,
0,
)
}
pub(crate) fn call_bytecode_function_inline(
@@ -331,7 +340,8 @@ impl Vm {
self.spill_stack.truncate(frame.spill_offset as usize);
self.regs[254] = frame.saved_this;
self.regs[255] = frame.saved_new_target;
self.active_reg_limit = frame.caller_reg_limit;
// active_reg_limit 还原为调用方真实值(caller_reg_limit 可能被存活上界截断)。
self.active_reg_limit = frame.caller_active_reg_limit;
self.pc = frame.return_addr;
}