mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 07:33:20 +00:00
LibJS+LibWeb: Inline fast path for Value::to_object()
Adds inline implementation for the most common case when `Value` is already an object. 1.47x improvement on the following benchmark: ```js const o = {}; for (let i = 0; i < 10_000_000; i++) { o.a = 1; o.b = 2; o.c = 3; } ```
This commit is contained in:
parent
f5fd6338d5
commit
85e029b2e7
Notes:
github-actions[bot]
2025-09-15 10:18:00 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 85e029b2e7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6185
Reviewed-by: https://github.com/konradekk
16 changed files with 22 additions and 1 deletions
|
@ -585,7 +585,7 @@ ThrowCompletionOr<Value> Value::to_primitive_slow_case(VM& vm, PreferredType pre
|
|||
}
|
||||
|
||||
// 7.1.18 ToObject ( argument ), https://tc39.es/ecma262/#sec-toobject
|
||||
ThrowCompletionOr<GC::Ref<Object>> Value::to_object(VM& vm) const
|
||||
ThrowCompletionOr<GC::Ref<Object>> Value::to_object_slow(VM& vm) const
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
VERIFY(!is_special_empty_value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue