From df3ff76815893104eb1c2686c4e51d70793c28f3 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 21 Sep 2020 13:36:32 +0200 Subject: [PATCH] LibJS: Rename InterpreterScope => InterpreterExecutionScope To make it a little clearer what this is for. (This is an RAII helper class for adding and removing an Interpreter to a VM's list of the currently active (executing code) Interpreters.) --- Applications/Spreadsheet/Workbook.cpp | 2 +- Applications/Spreadsheet/Workbook.h | 2 +- Libraries/LibJS/Interpreter.cpp | 4 ++-- Libraries/LibJS/Interpreter.h | 2 +- Libraries/LibJS/Runtime/VM.cpp | 4 ++-- Libraries/LibJS/Runtime/VM.h | 6 +++--- Userland/test-js.cpp | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Applications/Spreadsheet/Workbook.cpp b/Applications/Spreadsheet/Workbook.cpp index 252bb1d93ee..8fbe19dc1fb 100644 --- a/Applications/Spreadsheet/Workbook.cpp +++ b/Applications/Spreadsheet/Workbook.cpp @@ -48,7 +48,7 @@ static JS::VM& global_vm() Workbook::Workbook(NonnullRefPtrVector&& sheets) : m_sheets(move(sheets)) , m_interpreter(JS::Interpreter::create(global_vm())) - , m_interpreter_scope(JS::VM::InterpreterScope(interpreter())) + , m_interpreter_scope(JS::VM::InterpreterExecutionScope(interpreter())) { m_workbook_object = interpreter().heap().allocate(global_object(), *this); global_object().put("workbook", workbook_object()); diff --git a/Applications/Spreadsheet/Workbook.h b/Applications/Spreadsheet/Workbook.h index 60b12748ca7..c03fbfa5abc 100644 --- a/Applications/Spreadsheet/Workbook.h +++ b/Applications/Spreadsheet/Workbook.h @@ -66,7 +66,7 @@ public: private: NonnullRefPtrVector m_sheets; NonnullOwnPtr m_interpreter; - JS::VM::InterpreterScope m_interpreter_scope; + JS::VM::InterpreterExecutionScope m_interpreter_scope; WorkbookObject* m_workbook_object { nullptr }; String m_current_filename; diff --git a/Libraries/LibJS/Interpreter.cpp b/Libraries/LibJS/Interpreter.cpp index 56386e9ea5b..24927524f6c 100644 --- a/Libraries/LibJS/Interpreter.cpp +++ b/Libraries/LibJS/Interpreter.cpp @@ -60,7 +60,7 @@ Interpreter::~Interpreter() Value Interpreter::run(GlobalObject& global_object, const Program& program) { - VM::InterpreterScope scope(*this); + VM::InterpreterExecutionScope scope(*this); ASSERT(!exception()); @@ -253,7 +253,7 @@ Value Interpreter::call_internal(Function& function, Value this_value, Optional< { ASSERT(!exception()); - VM::InterpreterScope scope(*this); + VM::InterpreterExecutionScope scope(*this); auto& call_frame = push_call_frame(); call_frame.function_name = function.name(); diff --git a/Libraries/LibJS/Interpreter.h b/Libraries/LibJS/Interpreter.h index 86a90bdc514..645520ed01b 100644 --- a/Libraries/LibJS/Interpreter.h +++ b/Libraries/LibJS/Interpreter.h @@ -81,7 +81,7 @@ public: { DeferGC defer_gc(vm.heap()); auto interpreter = adopt_own(*new Interpreter(vm)); - VM::InterpreterScope scope(*interpreter); + VM::InterpreterExecutionScope scope(*interpreter); interpreter->m_global_object = make_handle(static_cast(interpreter->heap().allocate_without_global_object(forward(args)...))); static_cast(interpreter->m_global_object.cell())->initialize(); return interpreter; diff --git a/Libraries/LibJS/Runtime/VM.cpp b/Libraries/LibJS/Runtime/VM.cpp index 3a221d98628..066ddd9828a 100644 --- a/Libraries/LibJS/Runtime/VM.cpp +++ b/Libraries/LibJS/Runtime/VM.cpp @@ -71,13 +71,13 @@ void VM::pop_interpreter(Interpreter& interpreter) ASSERT(popped_interpreter == &interpreter); } -VM::InterpreterScope::InterpreterScope(Interpreter& interpreter) +VM::InterpreterExecutionScope::InterpreterExecutionScope(Interpreter& interpreter) : m_interpreter(interpreter) { m_interpreter.vm().push_interpreter(m_interpreter); } -VM::InterpreterScope::~InterpreterScope() +VM::InterpreterExecutionScope::~InterpreterExecutionScope() { m_interpreter.vm().pop_interpreter(m_interpreter); } diff --git a/Libraries/LibJS/Runtime/VM.h b/Libraries/LibJS/Runtime/VM.h index dd1b333cc0a..38a1f59b090 100644 --- a/Libraries/LibJS/Runtime/VM.h +++ b/Libraries/LibJS/Runtime/VM.h @@ -45,10 +45,10 @@ public: void push_interpreter(Interpreter&); void pop_interpreter(Interpreter&); - class InterpreterScope { + class InterpreterExecutionScope { public: - InterpreterScope(Interpreter&); - ~InterpreterScope(); + InterpreterExecutionScope(Interpreter&); + ~InterpreterExecutionScope(); private: Interpreter& m_interpreter; }; diff --git a/Userland/test-js.cpp b/Userland/test-js.cpp index 84d77276510..a6b9b11f17b 100644 --- a/Userland/test-js.cpp +++ b/Userland/test-js.cpp @@ -278,7 +278,7 @@ JSFileResult TestRunner::run_file_test(const String& test_path) auto interpreter = JS::Interpreter::create(*vm); // FIXME: This is a hack while we're refactoring Interpreter/VM stuff. - JS::VM::InterpreterScope scope(*interpreter); + JS::VM::InterpreterExecutionScope scope(*interpreter); interpreter->heap().set_should_collect_on_every_allocation(collect_on_every_allocation);