Jelajahi Sumber

LibJS/Bytecode: Remove Instruction::execute()

Just make sure everyone calls the instruction-specific execute_impl()
instead. :^)
Andreas Kling 1 tahun lalu
induk
melakukan
810a297626

+ 0 - 1
Userland/Libraries/LibJS/Bytecode/Instruction.h

@@ -148,7 +148,6 @@ public:
     Type type() const { return m_type; }
     size_t length() const;
     ByteString to_byte_string(Bytecode::Executable const&) const;
-    ThrowCompletionOr<void> execute(Bytecode::Interpreter&) const;
     void visit_labels(Function<void(Label&)> visitor);
     static void destroy(Instruction&);
 

+ 3 - 3
Userland/Libraries/LibJS/Bytecode/Interpreter.cpp

@@ -630,7 +630,7 @@ FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point)
 
         handle_Await: {
             auto& instruction = *reinterpret_cast<Op::Await const*>(&bytecode[program_counter]);
-            auto result = instruction.execute(*this);
+            auto result = instruction.execute_impl(*this);
 
             if (result.is_error()) {
                 if (handle_exception(program_counter, *result.throw_completion().value()) == HandleExceptionResponse::ExitFromExecutable)
@@ -642,7 +642,7 @@ FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point)
 
         handle_Return: {
             auto& instruction = *reinterpret_cast<Op::Return const*>(&bytecode[program_counter]);
-            auto result = instruction.execute(*this);
+            auto result = instruction.execute_impl(*this);
 
             if (result.is_error()) {
                 if (handle_exception(program_counter, *result.throw_completion().value()) == HandleExceptionResponse::ExitFromExecutable)
@@ -654,7 +654,7 @@ FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point)
 
         handle_Yield: {
             auto& instruction = *reinterpret_cast<Op::Yield const*>(&bytecode[program_counter]);
-            auto result = instruction.execute(*this);
+            auto result = instruction.execute_impl(*this);
 
             if (result.is_error()) {
                 if (handle_exception(program_counter, *result.throw_completion().value()) == HandleExceptionResponse::ExitFromExecutable)

+ 0 - 19
Userland/Libraries/LibJS/Bytecode/Op.h

@@ -2052,22 +2052,3 @@ private:
 };
 
 }
-
-namespace JS::Bytecode {
-
-ALWAYS_INLINE ThrowCompletionOr<void> Instruction::execute(Bytecode::Interpreter& interpreter) const
-{
-#define __BYTECODE_OP(op)       \
-    case Instruction::Type::op: \
-        return static_cast<Bytecode::Op::op const&>(*this).execute_impl(interpreter);
-
-    switch (type()) {
-        ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
-    default:
-        VERIFY_NOT_REACHED();
-    }
-
-#undef __BYTECODE_OP
-}
-
-}