Просмотр исходного кода

LibJS: Rename Bytecode::ExecutionUnit => Bytecode::Executable

Andreas Kling 4 лет назад
Родитель
Сommit
b61f198d22

+ 1 - 1
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());

+ 2 - 2
Userland/Libraries/LibJS/Bytecode/Generator.h

@@ -16,14 +16,14 @@
 
 namespace JS::Bytecode {
 
-struct ExecutionUnit {
+struct Executable {
     NonnullOwnPtrVector<BasicBlock> basic_blocks;
     size_t number_of_registers { 0 };
 };
 
 class Generator {
 public:
-    static ExecutionUnit generate(ASTNode const&);
+    static Executable generate(ASTNode const&);
 
     Register allocate_register();
 

+ 5 - 5
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<RegisterWindow>());
-    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) {

+ 1 - 1
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()]; }

+ 4 - 4
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<Interpreter> local_interpreter;
         ast_interpreter = vm.interpreter_if_exists();

+ 1 - 1
Userland/Libraries/LibJS/Runtime/ScriptFunction.h

@@ -48,7 +48,7 @@ private:
     FlyString m_name;
     NonnullRefPtr<Statement> m_body;
     const Vector<FunctionNode::Parameter> m_parameters;
-    Optional<Bytecode::ExecutionUnit> m_bytecode_execution_unit;
+    Optional<Bytecode::Executable> m_bytecode_executable;
     ScopeObject* m_parent_scope { nullptr };
     i32 m_function_length { 0 };
     bool m_is_strict { false };