1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +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

@ -112,6 +112,8 @@ public:
virtual bool is_array() const { return false; }
virtual bool is_function() const { return false; }
virtual bool is_typed_array() const { return false; }
virtual bool is_string_object() const { return false; }
virtual bool is_global_object() const { return false; }
virtual const char* class_name() const override { return "Object"; }
virtual void visit_edges(Cell::Visitor&) override;
@ -152,6 +154,9 @@ public:
void enable_transitions() { m_transitions_enabled = true; }
void disable_transitions() { m_transitions_enabled = false; }
template<typename T>
bool fast_is() const = delete;
protected:
enum class GlobalObjectTag { Tag };
enum class ConstructWithoutPrototypeTag { Tag };