Implement baseline JIT compiler for hot bytecode functions
Add a single-pass baseline JIT that compiles frequently-called bytecode
functions to AArch64 machine code. The compiler translates each bytecode
instruction to a call to a corresponding extern "C" helper function,
eliminating interpreter dispatch overhead while keeping implementation
simple and correct.
Key components:
- jit/compiler.rs: BaselineJit walks bytecode, emits native call sequences
and direct branches for control flow (Jump, JumpIfTrue, JumpIfFalse)
- jit/helpers.rs: extern "C" helper functions for all supported opcodes
including arithmetic, comparisons, property access with IC integration,
function calls, closures, and exception handling
- VM integration: per-function call counting (threshold=100), lazy JIT
buffer allocation, compiled code caching per GcRef, re-entrancy guard
to prevent recursive JIT dispatch, and run_to_depth for synchronous
callee execution from JIT code
Supported opcodes: LoadConst, LoadNull, LoadUndefined, LoadTrue, LoadFalse,
Move, LoadInt8, LoadGlobal, StoreGlobal, Add, Sub, Mul, Div, Rem, Neg,
BitAnd/Or/Xor, shifts, all comparisons, LogicalNot, TypeOf, Void, Jump,
JumpIfTrue/False/Nullish, Call, Return, Throw, CreateClosure, GetProperty,
SetProperty, GetPropertyByName, SetPropertyByName, CreateObject, CreateArray,
NewCell, CellLoad, CellStore, LoadUpvalue, StoreUpvalue, exception handlers.
Unsupported opcodes (Exp, InstanceOf, In, Delete, ForIn, Yield, Spread,
Await) bail out to the interpreter for correct execution.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>