Browse Source

LibJS: Make sure the global CallFrame doesn't go out of scope

The Bytecode::Interpreter will push a global call frame if needed,
and it needs to make sure that call frame survives until the end
of the Interpreter::run() function.
Andreas Kling 4 years ago
parent
commit
9330163b0b
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Userland/Libraries/LibJS/Bytecode/Interpreter.cpp

+ 1 - 1
Userland/Libraries/LibJS/Bytecode/Interpreter.cpp

@@ -36,8 +36,8 @@ Value Interpreter::run(Bytecode::Block const& block)
 {
     dbgln("Bytecode::Interpreter will run block {:p}", &block);
 
+    CallFrame global_call_frame;
     if (vm().call_stack().is_empty()) {
-        CallFrame global_call_frame;
         global_call_frame.this_value = &global_object();
         static FlyString global_execution_context_name = "(*BC* global execution context)";
         global_call_frame.function_name = global_execution_context_name;