1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibJS: Optimize reading known-to-be-initialized var bindings

`var` bindings are never in the temporal dead zone (TDZ), and so we
know accessing them will not throw.

We now take advantage of this by having a specialized environment
binding value getter that doesn't check for exceptional cases.

1.08x speedup on JetStream.
This commit is contained in:
Andreas Kling 2025-05-04 01:41:49 +02:00 committed by Andreas Kling
parent ad7c1e147f
commit bf1b754e91
Notes: github-actions[bot] 2025-05-04 00:32:11 +00:00
8 changed files with 90 additions and 15 deletions

View file

@ -59,6 +59,7 @@ public:
ThrowCompletionOr<void> initialize_binding_direct(VM&, size_t index, Value, InitializeBindingHint);
ThrowCompletionOr<void> set_mutable_binding_direct(VM&, size_t index, Value, bool strict);
ThrowCompletionOr<Value> get_binding_value_direct(VM&, size_t index) const;
Value get_initialized_binding_value_direct(size_t index) const { return m_bindings[index].value; }
void shrink_to_fit();