diff --git a/Userland/Libraries/LibJS/Bytecode/Generator.cpp b/Userland/Libraries/LibJS/Bytecode/Generator.cpp index 1bdd097312..c9141e682d 100644 --- a/Userland/Libraries/LibJS/Bytecode/Generator.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Generator.cpp @@ -21,7 +21,7 @@ Generator::~Generator() { } -ExecutionUnit Generator::generate(ASTNode const& node) +Executable Generator::generate(ASTNode const& node) { Generator generator; generator.switch_to_basic_block(generator.make_block()); diff --git a/Userland/Libraries/LibJS/Bytecode/Generator.h b/Userland/Libraries/LibJS/Bytecode/Generator.h index bf59eec66b..f7e115353b 100644 --- a/Userland/Libraries/LibJS/Bytecode/Generator.h +++ b/Userland/Libraries/LibJS/Bytecode/Generator.h @@ -16,14 +16,14 @@ namespace JS::Bytecode { -struct ExecutionUnit { +struct Executable { NonnullOwnPtrVector basic_blocks; size_t number_of_registers { 0 }; }; class Generator { public: - static ExecutionUnit generate(ASTNode const&); + static Executable generate(ASTNode const&); Register allocate_register(); diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 770ac091da..1b528c004a 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -33,9 +33,9 @@ Interpreter::~Interpreter() s_current = nullptr; } -Value Interpreter::run(ExecutionUnit const& execution_unit) +Value Interpreter::run(Executable const& executable) { - dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter will run unit {:p}", &execution_unit); + dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter will run unit {:p}", &executable); CallFrame global_call_frame; if (vm().call_stack().is_empty()) { @@ -50,9 +50,9 @@ Value Interpreter::run(ExecutionUnit const& execution_unit) VERIFY(!vm().exception()); } - auto block = &execution_unit.basic_blocks.first(); + auto block = &executable.basic_blocks.first(); m_register_windows.append(make()); - registers().resize(execution_unit.number_of_registers); + registers().resize(executable.number_of_registers); for (;;) { Bytecode::InstructionStreamIterator pc(block->instruction_stream()); @@ -80,7 +80,7 @@ Value Interpreter::run(ExecutionUnit const& execution_unit) break; } - dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter did run unit {:p}", &execution_unit); + dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter did run unit {:p}", &executable); if constexpr (JS_BYTECODE_DEBUG) { for (size_t i = 0; i < registers().size(); ++i) { diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.h b/Userland/Libraries/LibJS/Bytecode/Interpreter.h index c140fd61f4..8e5c495967 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.h +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.h @@ -28,7 +28,7 @@ public: GlobalObject& global_object() { return m_global_object; } VM& vm() { return m_vm; } - Value run(Bytecode::ExecutionUnit const&); + Value run(Bytecode::Executable const&); ALWAYS_INLINE Value& accumulator() { return reg(Register::accumulator()); } Value& reg(Register const& r) { return registers()[r.index()]; } diff --git a/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp b/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp index c58740b555..9deaaef637 100644 --- a/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp @@ -151,15 +151,15 @@ Value ScriptFunction::execute_function_body() if (bytecode_interpreter) { prepare_arguments(); - if (!m_bytecode_execution_unit.has_value()) { - m_bytecode_execution_unit = Bytecode::Generator::generate(m_body); + if (!m_bytecode_executable.has_value()) { + m_bytecode_executable = Bytecode::Generator::generate(m_body); if constexpr (JS_BYTECODE_DEBUG) { dbgln("Compiled Bytecode::Block for function '{}':", m_name); - for (auto& block : m_bytecode_execution_unit->basic_blocks) + for (auto& block : m_bytecode_executable->basic_blocks) block.dump(); } } - return bytecode_interpreter->run(*m_bytecode_execution_unit); + return bytecode_interpreter->run(*m_bytecode_executable); } else { OwnPtr local_interpreter; ast_interpreter = vm.interpreter_if_exists(); diff --git a/Userland/Libraries/LibJS/Runtime/ScriptFunction.h b/Userland/Libraries/LibJS/Runtime/ScriptFunction.h index c114946477..edc748130b 100644 --- a/Userland/Libraries/LibJS/Runtime/ScriptFunction.h +++ b/Userland/Libraries/LibJS/Runtime/ScriptFunction.h @@ -48,7 +48,7 @@ private: FlyString m_name; NonnullRefPtr m_body; const Vector m_parameters; - Optional m_bytecode_execution_unit; + Optional m_bytecode_executable; ScopeObject* m_parent_scope { nullptr }; i32 m_function_length { 0 }; bool m_is_strict { false };