mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +00:00
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:
@@ -31,9 +31,14 @@ OwnPtr<Block> Generator::generate(ASTNode const& node)
|
||||
return move(generator.m_block);
|
||||
}
|
||||
|
||||
void Generator::append(NonnullOwnPtr<Instruction> instruction)
|
||||
void Generator::grow(size_t additional_size)
|
||||
{
|
||||
m_block->append({}, move(instruction));
|
||||
m_block->grow(additional_size);
|
||||
}
|
||||
|
||||
void* Generator::next_slot()
|
||||
{
|
||||
return m_block->next_slot();
|
||||
}
|
||||
|
||||
Register Generator::allocate_register()
|
||||
@@ -44,7 +49,7 @@ Register Generator::allocate_register()
|
||||
|
||||
Label Generator::make_label() const
|
||||
{
|
||||
return Label { m_block->instructions().size() };
|
||||
return Label { m_block->instruction_stream().size() };
|
||||
}
|
||||
|
||||
Label Generator::nearest_continuable_scope() const
|
||||
|
||||
Reference in New Issue
Block a user