mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 01:22:43 +02:00
Instead of recursing through 5 native stack frames per JS function call (execute_call -> internal_call -> ordinary_call_evaluate_body -> run_executable -> run_bytecode), handle Call and CallConstruct for normal ECMAScript functions directly in the dispatch loop. The fast path allocates the callee's execution context on the InterpreterStack, copies arguments, sets up the environment, and jumps to the callee's bytecode entry point. Return and End unwind inline frames by restoring the caller's state. Exception unwinding walks through inline frames to find handlers. The fast path code is kept in NEVER_INLINE helper functions (try_inline_call, try_inline_call_construct, pop_inline_frame) to minimize register pressure in the dispatch loop. handle_exception takes program_counter by value to avoid forcing it onto the stack. Reloading of bytecode/program_counter after frame switches is done inline at each call site via RELOAD_AND_GOTO_START to preserve a single dispatch entry point for optimal indirect branch prediction.
151 KiB
151 KiB