diff options
author | Anonymous <anon@mous.org> | 2022-02-12 12:51:06 -0800 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-13 14:44:36 +0100 |
commit | 3a184f784186ad1c5a9704b05ab0902d577d5748 (patch) | |
tree | eeded57e00af7aeb0275468cd57f586be264155c /Userland/Libraries/LibJS/Runtime/Value.h | |
parent | 44a2ebea00a15f12eb01cac8c822dc5de2614056 (diff) | |
download | serenity-3a184f784186ad1c5a9704b05ab0902d577d5748.zip |
LibJS: Get rid of unnecessary work from canonical_numeric_index_string
The spec version of canonical_numeric_index_string is absurdly complex,
and ends up converting from a string to a number, and then back again
which is both slow and also requires a few allocations and a string
compare.
Instead lets use the logic we already have as that is much more
efficient.
This improves performance of all non-numeric property names.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Value.h')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Value.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index 7b96309cf9..6a001cf9b0 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -55,6 +55,7 @@ public: bool is_undefined() const { return m_type == Type::Undefined; } bool is_null() const { return m_type == Type::Null; } bool is_number() const { return m_type == Type::Int32 || m_type == Type::Double; } + bool is_int32() const { return m_type == Type::Int32; } bool is_string() const { return m_type == Type::String; } bool is_object() const { return m_type == Type::Object; } bool is_boolean() const { return m_type == Type::Boolean; } |