mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibJS: Add fast_is<T> helpers for all the primitive wrapper objects
The JS runtime is full of checks for is<NumberObject> and friends. They were showing up in a Speedometer profile as ~1% spent in dynamic_cast, and this basically chops that down to nothing.
This commit is contained in:
parent
3cc5b1a6a5
commit
c12f8b80dc
Notes:
github-actions[bot]
2025-03-25 23:58:13 +00:00
Author: https://github.com/awesomekling
Commit: c12f8b80dc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4081
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/shannonbooth
7 changed files with 35 additions and 0 deletions
|
@ -74,6 +74,7 @@ private:
|
|||
RegExpObject(Object& prototype);
|
||||
RegExpObject(Regex<ECMA262> regex, String pattern, String flags, Object& prototype);
|
||||
|
||||
virtual bool is_regexp_object() const final { return true; }
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
String m_pattern;
|
||||
|
@ -85,6 +86,9 @@ private:
|
|||
Optional<Regex<ECMA262>> m_regex;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool Object::fast_is<RegExpObject>() const { return is_regexp_object(); }
|
||||
|
||||
AK_ENUM_BITWISE_OPERATORS(RegExpObject::Flags);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue