mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibJS: Inline JS-to-JS calls in the bytecode interpreter dispatch loop
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.
This commit is contained in:
committed by
Andreas Kling
parent
4e0e16e510
commit
27fa0aac98
Notes:
github-actions[bot]
2026-03-04 17:54:27 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/27fa0aac98b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8270
@@ -121,6 +121,7 @@ public:
|
||||
bool allocates_function_environment() const { return shared_data().m_function_environment_needed; }
|
||||
|
||||
friend class Bytecode::Generator;
|
||||
friend class Bytecode::Interpreter;
|
||||
|
||||
private:
|
||||
ECMAScriptFunctionObject(
|
||||
|
||||
Reference in New Issue
Block a user