LibJS: Devirtualize and pack the bytecode stream :^)

This patch changes the LibJS bytecode to be a stream of instructions
packed one-after-the-other in contiguous memory, instead of a vector
of OwnPtr<Instruction>. This should be a lot more cache-friendly. :^)

Instructions are also devirtualized and instead have a type field
using a new Instruction::Type enum.

To iterate over a bytecode stream, one must now use
Bytecode::InstructionStreamIterator.
This commit is contained in:
Andreas Kling 2021-06-07 15:12:43 +02:00
commit e7d69c5d3c
Notes: sideshowbarker 2024-07-18 12:41:47 +09:00
11 changed files with 284 additions and 110 deletions

View file

@ -180,7 +180,7 @@ Optional<Bytecode::Register> CallExpression::generate_bytecode(Bytecode::Generat
for (auto& arg : m_arguments)
argument_registers.append(*arg.value->generate_bytecode(generator));
auto dst_reg = generator.allocate_register();
generator.emit<Bytecode::Op::Call>(dst_reg, *callee_reg, this_reg, argument_registers);
generator.emit_with_extra_register_slots<Bytecode::Op::Call>(argument_registers.size(), dst_reg, *callee_reg, this_reg, argument_registers);
return dst_reg;
}