mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-02 06:04:15 +00:00
LibJS/Bytecode: Remove Instruction::execute()
Just make sure everyone calls the instruction-specific execute_impl() instead. :^)
This commit is contained in:
parent
601e10d50c
commit
810a297626
|
@ -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&);
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue