mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02: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:
Notes:
sideshowbarker
2024-07-16 21:42:29 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3a73eb99ac Pull-request: https://github.com/SerenityOS/serenity/pull/24240 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/trflynn89 ✅
@@ -10,13 +10,14 @@
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
||||
NonnullOwnPtr<BasicBlock> BasicBlock::create(String name)
|
||||
NonnullOwnPtr<BasicBlock> BasicBlock::create(u32 index, String name)
|
||||
{
|
||||
return adopt_own(*new BasicBlock(move(name)));
|
||||
return adopt_own(*new BasicBlock(index, move(name)));
|
||||
}
|
||||
|
||||
BasicBlock::BasicBlock(String name)
|
||||
: m_name(move(name))
|
||||
BasicBlock::BasicBlock(u32 index, String name)
|
||||
: m_index(index)
|
||||
, m_name(move(name))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user