mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-05-27 05:29:27 +00:00
LibJS/Bytecode: Cache realm, global object, and more in interpreter
Instead of looking these up in the VM execution context stack whenever we need them, we now just cache them in the interpreter when entering a new call frame.
This commit is contained in:
@@ -426,6 +426,9 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable& executa
|
||||
|
||||
TemporaryChange restore_executable { m_current_executable, &executable };
|
||||
TemporaryChange restore_saved_jump { m_scheduled_jump, static_cast<BasicBlock const*>(nullptr) };
|
||||
TemporaryChange restore_realm { m_realm, vm().current_realm() };
|
||||
TemporaryChange restore_global_object { m_global_object, &m_realm->global_object() };
|
||||
TemporaryChange restore_global_declarative_environment { m_global_declarative_environment, &m_realm->global_environment().declarative_record() };
|
||||
|
||||
VERIFY(!vm().execution_context_stack().is_empty());
|
||||
|
||||
@@ -530,11 +533,6 @@ ThrowCompletionOr<NonnullGCPtr<Bytecode::Executable>> compile(VM& vm, ASTNode co
|
||||
return bytecode_executable;
|
||||
}
|
||||
|
||||
Realm& Interpreter::realm()
|
||||
{
|
||||
return *m_vm.current_realm();
|
||||
}
|
||||
|
||||
void Interpreter::push_call_frame(Variant<NonnullOwnPtr<CallFrame>, CallFrame*> frame)
|
||||
{
|
||||
m_call_frames.append(move(frame));
|
||||
|
||||
Reference in New Issue
Block a user