diff --git a/Libraries/LibJS/Runtime/BoundFunction.h b/Libraries/LibJS/Runtime/BoundFunction.h index b22673cb0c..1e8b3e46b3 100644 --- a/Libraries/LibJS/Runtime/BoundFunction.h +++ b/Libraries/LibJS/Runtime/BoundFunction.h @@ -36,9 +36,14 @@ private: ThrowCompletionOr get_stack_frame_size(size_t& registers_and_constants_and_locals_count, size_t& argument_count) override; virtual void visit_edges(Visitor&) override; + virtual bool is_bound_function() const final { return true; } + GC::Ptr m_bound_target_function; // [[BoundTargetFunction]] Value m_bound_this; // [[BoundThis]] Vector m_bound_arguments; // [[BoundArguments]] }; +template<> +inline bool FunctionObject::fast_is() const { return is_bound_function(); } + } diff --git a/Libraries/LibJS/Runtime/FunctionObject.h b/Libraries/LibJS/Runtime/FunctionObject.h index 78355a2ce3..5506b6ec28 100644 --- a/Libraries/LibJS/Runtime/FunctionObject.h +++ b/Libraries/LibJS/Runtime/FunctionObject.h @@ -42,6 +42,9 @@ public: virtual FunctionParameters const& formal_parameters() const { VERIFY_NOT_REACHED(); } + template + bool fast_is() const = delete; + protected: explicit FunctionObject(Realm&, Object* prototype, MayInterfereWithIndexedPropertyAccess = MayInterfereWithIndexedPropertyAccess::No); explicit FunctionObject(Object& prototype, MayInterfereWithIndexedPropertyAccess = MayInterfereWithIndexedPropertyAccess::No); @@ -50,6 +53,7 @@ protected: private: virtual bool is_function() const override { return true; } + virtual bool is_bound_function() const { return false; } }; template<>