From dc884aa0d3f73f800fe64a9130bf3168325fff84 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 2 Jul 2023 15:05:17 +0200 Subject: [PATCH] LibJS/Bytecode: Remove unnecessary variable environment stack The var environments will unwind as needed with the ExecutionContext and there's no need to include it in the unwind info. We still need to do this for lexical environments though, since they can have short local lifetimes inside a function. --- Userland/Libraries/LibJS/Bytecode/BasicBlock.h | 1 - Userland/Libraries/LibJS/Bytecode/Interpreter.cpp | 6 ++---- Userland/Libraries/LibJS/Bytecode/Interpreter.h | 5 ----- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/BasicBlock.h b/Userland/Libraries/LibJS/Bytecode/BasicBlock.h index 653989de31..dde4c1bed1 100644 --- a/Userland/Libraries/LibJS/Bytecode/BasicBlock.h +++ b/Userland/Libraries/LibJS/Bytecode/BasicBlock.h @@ -19,7 +19,6 @@ struct UnwindInfo { BasicBlock const* finalizer; JS::GCPtr lexical_environment; - JS::GCPtr variable_environment; }; class BasicBlock { diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 317ebe5bd1..bb9d8bb884 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -221,7 +221,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Realm& realm, Execu if (in_frame) push_register_window(in_frame, executable.number_of_registers); else - push_register_window(make(MarkedVector(vm().heap()), MarkedVector>(vm().heap()), MarkedVector>(vm().heap()), Vector {}), executable.number_of_registers); + push_register_window(make(), executable.number_of_registers); for (;;) { Bytecode::InstructionStreamIterator pc(m_current_block->instruction_stream()); @@ -244,7 +244,6 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Realm& realm, Execu break; if (unwind_context.handler) { vm().running_execution_context().lexical_environment = unwind_context.lexical_environment; - vm().running_execution_context().variable_environment = unwind_context.variable_environment; m_current_block = unwind_context.handler; unwind_context.handler = nullptr; @@ -361,8 +360,7 @@ void Interpreter::enter_unwind_context(Optional