diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-19 11:28:44 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-19 23:12:47 +0100 |
commit | 0a911178cea4fcfb462eb7e256c51ed75756c7c8 (patch) | |
tree | 3a39005c6eeb9b9f21fc2b9d7fdb1b2c965a69a2 /Userland/Libraries/LibJS/Runtime/GlobalObject.h | |
parent | 43f0c92bcd7749fafe4b72206aed6b15fb14a4e4 (diff) | |
download | serenity-0a911178cea4fcfb462eb7e256c51ed75756c7c8.zip |
LibJS: Add fast_is<T> for StringObject and GlobalObject
Both of these are quite hot in profiles.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/GlobalObject.h')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/GlobalObject.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.h b/Userland/Libraries/LibJS/Runtime/GlobalObject.h index 6261a23077..1062a3f75d 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.h +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.h @@ -76,6 +76,8 @@ protected: void add_constructor(const FlyString& property_name, ConstructorType*&, Object* prototype); private: + virtual bool is_global_object() const final { return true; } + JS_DECLARE_NATIVE_FUNCTION(gc); JS_DECLARE_NATIVE_FUNCTION(is_nan); JS_DECLARE_NATIVE_FUNCTION(is_finite); @@ -131,4 +133,7 @@ inline GlobalObject* Shape::global_object() const return static_cast<GlobalObject*>(m_global_object); } +template<> +inline bool Object::fast_is<GlobalObject>() const { return is_global_object(); } + } |