mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
LibJS: Move Bytecode::Instruction::execute() to the Op.h header
..and make sure it always gets inlined in the interpreter loop.
This commit is contained in:
parent
b61f198d22
commit
48a8022cf6
Notes:
sideshowbarker
2024-07-18 12:35:26 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/48a8022cf69
@ -8,6 +8,7 @@
|
||||
#include <LibJS/Bytecode/BasicBlock.h>
|
||||
#include <LibJS/Bytecode/Instruction.h>
|
||||
#include <LibJS/Bytecode/Interpreter.h>
|
||||
#include <LibJS/Bytecode/Op.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
@ -16,21 +16,6 @@
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
||||
void Instruction::execute(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
#define __BYTECODE_OP(op) \
|
||||
case Instruction::Type::op: \
|
||||
return static_cast<Bytecode::Op::op const&>(*this).execute(interpreter);
|
||||
|
||||
switch (type()) {
|
||||
ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
#undef __BYTECODE_OP
|
||||
}
|
||||
|
||||
String Instruction::to_string() const
|
||||
{
|
||||
#define __BYTECODE_OP(op) \
|
||||
|
@ -374,3 +374,22 @@ public:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
||||
ALWAYS_INLINE void Instruction::execute(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
#define __BYTECODE_OP(op) \
|
||||
case Instruction::Type::op: \
|
||||
return static_cast<Bytecode::Op::op const&>(*this).execute(interpreter);
|
||||
|
||||
switch (type()) {
|
||||
ENUMERATE_BYTECODE_OPS(__BYTECODE_OP)
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
#undef __BYTECODE_OP
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user