Eliminate redundant OP_MOVE in plain function call compilation#86
Conversation
When the destination register is at the top of the register stack and not a local variable slot, CompileCall now compiles the call directly into ADest instead of allocating a temp register and emitting OP_MOVE. This eliminates one instruction per function call in common patterns like expression statements, binary expression operands, and nested call arguments. Made-with: Cursor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughOptimizes register allocation in the generic call path of CompileCall by introducing an IsLocalSlot helper function and adding conditional logic to prefer using ADest as BaseReg when appropriate, reducing unnecessary register allocations and moves. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Suite Timing
Measured on ubuntu-latest x64. |
Benchmark Results254 benchmarks Interpreted: 🟢 87 improved · 🔴 3 regressed · 164 unchanged · avg +4.7% arraybuffer.js — Interp: 🟢 11, 3 unch. · avg +10.1% · Bytecode: 14 unch. · avg +3.4%
arrays.js — Interp: 🟢 12, 7 unch. · avg +7.8% · Bytecode: 🟢 5, 14 unch. · avg +4.6%
async-await.js — Interp: 🟢 6 · avg +9.5% · Bytecode: 6 unch. · avg +3.2%
classes.js — Interp: 🟢 29, 2 unch. · avg +11.2% · Bytecode: 🟢 7, 24 unch. · avg +5.6%
closures.js — Interp: 11 unch. · avg +3.6% · Bytecode: 🟢 3, 8 unch. · avg +6.3%
collections.js — Interp: 🟢 2, 10 unch. · avg +5.4% · Bytecode: 12 unch. · avg +1.5%
destructuring.js — Interp: 🟢 14, 8 unch. · avg +8.5% · Bytecode: 🟢 11, 11 unch. · avg +12.1%
fibonacci.js — Interp: 🟢 2, 6 unch. · avg +2.8% · Bytecode: 🟢 3, 5 unch. · avg +6.2%
for-of.js — Interp: 7 unch. · avg +0.8% · Bytecode: 🟢 1, 6 unch. · avg +5.2%
iterators.js — Interp: 🟢 2, 18 unch. · avg +2.7% · Bytecode: 🟢 5, 15 unch. · avg +3.7%
json.js — Interp: 🟢 1, 19 unch. · avg +2.9% · Bytecode: 20 unch. · avg +2.4%
jsx.jsx — Interp: 21 unch. · avg +2.8% · Bytecode: 21 unch. · avg +2.8%
numbers.js — Interp: 🟢 1, 10 unch. · avg +2.7% · Bytecode: 🟢 4, 7 unch. · avg +5.5%
objects.js — Interp: 7 unch. · avg -2.0% · Bytecode: 🟢 2, 5 unch. · avg +6.3%
promises.js — Interp: 🔴 2, 10 unch. · avg -3.9% · Bytecode: 🟢 2, 🔴 1, 9 unch. · avg +0.7%
strings.js — Interp: 🔴 1, 10 unch. · avg -3.4% · Bytecode: 🟢 5, 6 unch. · avg +6.6%
typed-arrays.js — Interp: 🟢 7, 15 unch. · avg +3.2% · Bytecode: 🟢 1, 21 unch. · avg +1.6%
Measured on ubuntu-latest x64. Changes within ±7% are considered insignificant. |
Summary
Test plan
Made with Cursor
Summary by CodeRabbit