mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibJS/Bytecode: Store labels as basic block index during compilation
Instead of storing a BasicBlock* and forcing the size of Label to be sizeof(BasicBlock*), we now store the basic block index as a u32. This means the final version of the bytecode is able to keep labels at sizeof(u32), shrinking the size of many instructions. :^)
This commit is contained in:
parent
5a08544138
commit
3a73eb99ac
Notes:
sideshowbarker
2024-07-16 21:42:29 +09:00
Author: https://github.com/awesomekling
Commit: 3a73eb99ac
Pull-request: https://github.com/SerenityOS/serenity/pull/24240
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/trflynn89 ✅
7 changed files with 40 additions and 22 deletions
|
@ -150,12 +150,12 @@ public:
|
|||
{
|
||||
if (name.is_empty())
|
||||
name = MUST(String::number(m_next_block++));
|
||||
auto block = BasicBlock::create(name);
|
||||
auto block = BasicBlock::create(m_root_basic_blocks.size(), name);
|
||||
if (auto const* context = m_current_unwind_context) {
|
||||
if (context->handler().has_value())
|
||||
block->set_handler(context->handler().value().block());
|
||||
block->set_handler(*m_root_basic_blocks[context->handler().value().basic_block_index()]);
|
||||
if (m_current_unwind_context->finalizer().has_value())
|
||||
block->set_finalizer(context->finalizer().value().block());
|
||||
block->set_finalizer(*m_root_basic_blocks[context->finalizer().value().basic_block_index()]);
|
||||
}
|
||||
m_root_basic_blocks.append(move(block));
|
||||
return *m_root_basic_blocks.last();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue