mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 01:40:46 +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
|
@ -31,9 +31,14 @@ public:
|
|||
private:
|
||||
Date(double date_value, Object& prototype);
|
||||
|
||||
virtual bool is_date() const final { return true; }
|
||||
|
||||
double m_date_value { 0 }; // [[DateValue]]
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool Object::fast_is<Date>() const { return is_date(); }
|
||||
|
||||
// 21.4.1.22 Time Zone Identifier Record, https://tc39.es/ecma262/#sec-time-zone-identifier-record
|
||||
struct TimeZoneIdentifier {
|
||||
String identifier; // [[Identifier]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue