浏览代码

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 年之前
父节点
当前提交
9330163b0b
共有 1 个文件被更改,包括 1 次插入1 次删除
  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);
     dbgln("Bytecode::Interpreter will run block {:p}", &block);
 
 
+    CallFrame global_call_frame;
     if (vm().call_stack().is_empty()) {
     if (vm().call_stack().is_empty()) {
-        CallFrame global_call_frame;
         global_call_frame.this_value = &global_object();
         global_call_frame.this_value = &global_object();
         static FlyString global_execution_context_name = "(*BC* global execution context)";
         static FlyString global_execution_context_name = "(*BC* global execution context)";
         global_call_frame.function_name = global_execution_context_name;
         global_call_frame.function_name = global_execution_context_name;