1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +00:00

LibJS: Add fast_is<T> for StringObject and GlobalObject

Both of these are quite hot in profiles.
This commit is contained in:
Andreas Kling 2021-03-19 11:28:44 +01:00
parent 43f0c92bcd
commit 0a911178ce
3 changed files with 14 additions and 0 deletions

View file

@ -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(); }
}