mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-27 04:37:22 +00:00
LibJS: Store bytecode VM program counter in ExecutionContext
This way it's always automatically correct, and we don't have to manually flush it in push_execution_context(). ~7% speedup on the MicroBench/call* tests :^)
This commit is contained in:
parent
e7ae9c8ebf
commit
4d17707b26
Notes:
github-actions[bot]
2025-04-28 19:13:46 +00:00
Author: https://github.com/awesomekling
Commit: 4d17707b26
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4509
Reviewed-by: https://github.com/gmta ✅
6 changed files with 22 additions and 33 deletions
|
@ -115,12 +115,21 @@ public:
|
|||
if (did_reach_stack_space_limit()) [[unlikely]] {
|
||||
return throw_completion<InternalError>(ErrorType::CallStackSizeExceeded);
|
||||
}
|
||||
push_execution_context(context);
|
||||
m_execution_context_stack.append(&context);
|
||||
return {};
|
||||
}
|
||||
|
||||
void push_execution_context(ExecutionContext&);
|
||||
void pop_execution_context();
|
||||
void push_execution_context(ExecutionContext& context)
|
||||
{
|
||||
m_execution_context_stack.append(&context);
|
||||
}
|
||||
|
||||
void pop_execution_context()
|
||||
{
|
||||
m_execution_context_stack.take_last();
|
||||
if (m_execution_context_stack.is_empty() && on_call_stack_emptied)
|
||||
on_call_stack_emptied();
|
||||
}
|
||||
|
||||
// https://tc39.es/ecma262/#running-execution-context
|
||||
// At any point in time, there is at most one execution context per agent that is actually executing code.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue