mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibJS/Bytecode: Only emit ResolveThisBinding once per basic block
Once executed, this instruction will always produce the same result in subsequent executions, so it's okay to cache it. Unfortunately it may throw, so we can't just hoist it to the top of every executable, since that would break observable execution order.
This commit is contained in:
parent
a447b9bffd
commit
0f70ff9a67
Notes:
sideshowbarker
2024-07-17 08:43:11 +09:00
Author: https://github.com/awesomekling
Commit: 0f70ff9a67
Pull-request: https://github.com/SerenityOS/serenity/pull/24260
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/mattco98
4 changed files with 21 additions and 7 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/Badge.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibJS/Bytecode/Executable.h>
|
||||
#include <LibJS/Bytecode/Operand.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/Handle.h>
|
||||
|
||||
|
@ -51,6 +52,9 @@ public:
|
|||
auto const& source_map() const { return m_source_map; }
|
||||
void add_source_map_entry(size_t bytecode_offset, SourceRecord const& source_record) { m_source_map.set(bytecode_offset, source_record); }
|
||||
|
||||
auto const& this_() const { return m_this; }
|
||||
void set_this(Operand operand) { m_this = operand; }
|
||||
|
||||
private:
|
||||
explicit BasicBlock(u32 index, String name);
|
||||
|
||||
|
@ -62,6 +66,8 @@ private:
|
|||
bool m_terminated { false };
|
||||
|
||||
HashMap<size_t, SourceRecord> m_source_map;
|
||||
|
||||
Optional<Operand> m_this;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue