diff options
author | Anonymous <anon@mous.org> | 2022-02-12 00:48:23 -0800 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-13 14:44:36 +0100 |
commit | d1cc67bbe12d66aca2a716011697337664b72e6d (patch) | |
tree | b4d49b40067009ce0d530775cbe0109b17700a91 /Userland/Libraries/LibJS/Runtime/Map.h | |
parent | 3a184f784186ad1c5a9704b05ab0902d577d5748 (diff) | |
download | serenity-d1cc67bbe12d66aca2a716011697337664b72e6d.zip |
LibJS: Avoid unnecessary ToObject conversion when resolving references
When performing GetValue on a primitive type we do not need to perform
the ToObject conversion as it will resolve to a property on the
prototype object.
To avoid this we skip the initial ToObject conversion on the base value
as it only serves to get the primitive's boxed prototype. We further
specialize on PrimitiveString in order to get efficient behaviour
behaviour for the direct properties.
Depending on the tests anywhere from 20 to 60%, with significant loop
overhead.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Map.h')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Map.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Map.h b/Userland/Libraries/LibJS/Runtime/Map.h index 476aa7bee7..3cce53cfab 100644 --- a/Userland/Libraries/LibJS/Runtime/Map.h +++ b/Userland/Libraries/LibJS/Runtime/Map.h @@ -12,6 +12,7 @@ #include <LibJS/Runtime/GlobalObject.h> #include <LibJS/Runtime/Object.h> #include <LibJS/Runtime/Value.h> +#include <LibJS/Runtime/ValueTraits.h> namespace JS { |