1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:37:35 +00:00

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.)
This commit is contained in:
Andreas Kling 2020-09-21 13:36:32 +02:00
parent b7ce0680dd
commit df3ff76815
7 changed files with 11 additions and 11 deletions

View file

@ -48,7 +48,7 @@ static JS::VM& global_vm()
Workbook::Workbook(NonnullRefPtrVector<Sheet>&& sheets) Workbook::Workbook(NonnullRefPtrVector<Sheet>&& sheets)
: m_sheets(move(sheets)) : m_sheets(move(sheets))
, m_interpreter(JS::Interpreter::create<JS::GlobalObject>(global_vm())) , m_interpreter(JS::Interpreter::create<JS::GlobalObject>(global_vm()))
, m_interpreter_scope(JS::VM::InterpreterScope(interpreter())) , m_interpreter_scope(JS::VM::InterpreterExecutionScope(interpreter()))
{ {
m_workbook_object = interpreter().heap().allocate<WorkbookObject>(global_object(), *this); m_workbook_object = interpreter().heap().allocate<WorkbookObject>(global_object(), *this);
global_object().put("workbook", workbook_object()); global_object().put("workbook", workbook_object());

View file

@ -66,7 +66,7 @@ public:
private: private:
NonnullRefPtrVector<Sheet> m_sheets; NonnullRefPtrVector<Sheet> m_sheets;
NonnullOwnPtr<JS::Interpreter> m_interpreter; NonnullOwnPtr<JS::Interpreter> m_interpreter;
JS::VM::InterpreterScope m_interpreter_scope; JS::VM::InterpreterExecutionScope m_interpreter_scope;
WorkbookObject* m_workbook_object { nullptr }; WorkbookObject* m_workbook_object { nullptr };
String m_current_filename; String m_current_filename;

View file

@ -60,7 +60,7 @@ Interpreter::~Interpreter()
Value Interpreter::run(GlobalObject& global_object, const Program& program) Value Interpreter::run(GlobalObject& global_object, const Program& program)
{ {
VM::InterpreterScope scope(*this); VM::InterpreterExecutionScope scope(*this);
ASSERT(!exception()); ASSERT(!exception());
@ -253,7 +253,7 @@ Value Interpreter::call_internal(Function& function, Value this_value, Optional<
{ {
ASSERT(!exception()); ASSERT(!exception());
VM::InterpreterScope scope(*this); VM::InterpreterExecutionScope scope(*this);
auto& call_frame = push_call_frame(); auto& call_frame = push_call_frame();
call_frame.function_name = function.name(); call_frame.function_name = function.name();

View file

@ -81,7 +81,7 @@ public:
{ {
DeferGC defer_gc(vm.heap()); DeferGC defer_gc(vm.heap());
auto interpreter = adopt_own(*new Interpreter(vm)); auto interpreter = adopt_own(*new Interpreter(vm));
VM::InterpreterScope scope(*interpreter); VM::InterpreterExecutionScope scope(*interpreter);
interpreter->m_global_object = make_handle(static_cast<Object*>(interpreter->heap().allocate_without_global_object<GlobalObjectType>(forward<Args>(args)...))); interpreter->m_global_object = make_handle(static_cast<Object*>(interpreter->heap().allocate_without_global_object<GlobalObjectType>(forward<Args>(args)...)));
static_cast<GlobalObjectType*>(interpreter->m_global_object.cell())->initialize(); static_cast<GlobalObjectType*>(interpreter->m_global_object.cell())->initialize();
return interpreter; return interpreter;

View file

@ -71,13 +71,13 @@ void VM::pop_interpreter(Interpreter& interpreter)
ASSERT(popped_interpreter == &interpreter); ASSERT(popped_interpreter == &interpreter);
} }
VM::InterpreterScope::InterpreterScope(Interpreter& interpreter) VM::InterpreterExecutionScope::InterpreterExecutionScope(Interpreter& interpreter)
: m_interpreter(interpreter) : m_interpreter(interpreter)
{ {
m_interpreter.vm().push_interpreter(m_interpreter); m_interpreter.vm().push_interpreter(m_interpreter);
} }
VM::InterpreterScope::~InterpreterScope() VM::InterpreterExecutionScope::~InterpreterExecutionScope()
{ {
m_interpreter.vm().pop_interpreter(m_interpreter); m_interpreter.vm().pop_interpreter(m_interpreter);
} }

View file

@ -45,10 +45,10 @@ public:
void push_interpreter(Interpreter&); void push_interpreter(Interpreter&);
void pop_interpreter(Interpreter&); void pop_interpreter(Interpreter&);
class InterpreterScope { class InterpreterExecutionScope {
public: public:
InterpreterScope(Interpreter&); InterpreterExecutionScope(Interpreter&);
~InterpreterScope(); ~InterpreterExecutionScope();
private: private:
Interpreter& m_interpreter; Interpreter& m_interpreter;
}; };

View file

@ -278,7 +278,7 @@ JSFileResult TestRunner::run_file_test(const String& test_path)
auto interpreter = JS::Interpreter::create<TestRunnerGlobalObject>(*vm); auto interpreter = JS::Interpreter::create<TestRunnerGlobalObject>(*vm);
// FIXME: This is a hack while we're refactoring Interpreter/VM stuff. // 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); interpreter->heap().set_should_collect_on_every_allocation(collect_on_every_allocation);