mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
LibJS: Correctly return cached value for global var bindings
When the cached value was not an accessor, it was simply ignored. This is the value we really want, so we can just return it. Shows up to 5x improvements on some benchmarks, and 1.4x in general js-benchmarks.
This commit is contained in:
parent
b6a5b7e186
commit
77a46ab1b8
Notes:
github-actions[bot]
2024-11-12 20:14:45 +00:00
Author: https://github.com/OHermesJunior Commit: https://github.com/LadybirdBrowser/ladybird/commit/77a46ab1b8d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2304
1 changed files with 1 additions and 0 deletions
|
@ -1118,6 +1118,7 @@ inline ThrowCompletionOr<Value> get_global(Interpreter& interpreter, IdentifierT
|
|||
auto value = binding_object.get_direct(cache.property_offset.value());
|
||||
if (value.is_accessor())
|
||||
return TRY(call(vm, value.as_accessor().getter(), js_undefined()));
|
||||
return value;
|
||||
}
|
||||
|
||||
// OPTIMIZATION: For global lexical bindings, if the global declarative environment hasn't changed,
|
||||
|
|
Loading…
Reference in a new issue