LibJS/Bytecode: Remove Instruction::execute()

Just make sure everyone calls the instruction-specific execute_impl()
instead. :^)
This commit is contained in:
Andreas Kling 2024-05-10 07:43:31 +02:00 committed by Alexander Kalenik
parent 601e10d50c
commit 810a297626
3 changed files with 3 additions and 23 deletions

View file

@ -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&);

View file

@ -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)

View file

@ -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
}
}