mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibJS/Bytecode: Make NewArray a variable-length instruction
This removes a layer of indirection in the bytecode where we had to make sure all the initializer elements were laid out in sequential registers. Array expressions no longer clobber registers permanently, and they can be reused immediately afterwards.
This commit is contained in:
parent
cea59b6642
commit
6873628317
Notes:
sideshowbarker
2024-07-17 03:59:29 +09:00
Author: https://github.com/awesomekling
Commit: 6873628317
Pull-request: https://github.com/SerenityOS/serenity/pull/24260
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/mattco98
5 changed files with 40 additions and 81 deletions
|
@ -220,18 +220,13 @@ void Generator::grow(size_t additional_size)
|
|||
m_current_basic_block->grow(additional_size);
|
||||
}
|
||||
|
||||
ScopedOperand Generator::allocate_sequential_register()
|
||||
{
|
||||
VERIFY(m_next_register != NumericLimits<u32>::max());
|
||||
return ScopedOperand { *this, Operand { Register { m_next_register++ } } };
|
||||
}
|
||||
|
||||
ScopedOperand Generator::allocate_register()
|
||||
{
|
||||
if (!m_free_registers.is_empty()) {
|
||||
return ScopedOperand { *this, Operand { m_free_registers.take_last() } };
|
||||
}
|
||||
return allocate_sequential_register();
|
||||
VERIFY(m_next_register != NumericLimits<u32>::max());
|
||||
return ScopedOperand { *this, Operand { Register { m_next_register++ } } };
|
||||
}
|
||||
|
||||
void Generator::free_register(Register reg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue