mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
LibJS/Bytecode: Allow all basic blocks to use cached this
from block 0
The first block in every executable will always execute first, so if it ends up doing a ResolveThisBinding, it's fine for all other blocks within the same executable to use the same `this` value.
This commit is contained in:
parent
55a4b0a21e
commit
f537d0b3cf
Notes:
sideshowbarker
2024-07-17 21:26:19 +09:00
Author: https://github.com/awesomekling
Commit: f537d0b3cf
Pull-request: https://github.com/SerenityOS/serenity/pull/24260
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/mattco98
1 changed files with 4 additions and 0 deletions
|
@ -802,6 +802,10 @@ Operand Generator::get_this(Optional<Operand> preferred_dst)
|
|||
{
|
||||
if (m_current_basic_block->this_().has_value())
|
||||
return m_current_basic_block->this_().value();
|
||||
if (m_root_basic_blocks[0]->this_().has_value()) {
|
||||
m_current_basic_block->set_this(m_root_basic_blocks[0]->this_().value());
|
||||
return m_root_basic_blocks[0]->this_().value();
|
||||
}
|
||||
auto dst = preferred_dst.has_value() ? preferred_dst.value() : Operand(allocate_register());
|
||||
emit<Bytecode::Op::ResolveThisBinding>(dst);
|
||||
m_current_basic_block->set_this(dst);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue