LibJS: Avoid calling generic Instruction::length() during dispatch

Since we know the exact type, we can avoid calling the generic lookup
function that branches on instruction type.
This commit is contained in:
Andreas Kling 2025-04-03 11:12:35 +02:00 committed by Andreas Kling
parent 4b04e97feb
commit 8f2ee01e6f
Notes: github-actions[bot] 2025-04-03 11:57:56 +00:00
2 changed files with 9 additions and 1 deletions

View file

@ -386,7 +386,7 @@ FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point)
#define DISPATCH_NEXT(name) \
do { \
if constexpr (Op::name::IsVariableLength) \
program_counter += instruction.length(); \
program_counter += static_cast<Op::name const&>(instruction).length(); \
else \
program_counter += sizeof(Op::name); \
auto& next_instruction = *reinterpret_cast<Instruction const*>(&bytecode[program_counter]); \