1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibJS: Stop lazily coercing numeric PropertyKeys

Lazily coercing might have made sense in the past, but since hashing
and comparing requires the `PropertyKey` to be coerced, and since a
`PropertyKey` will be used to index into a hashmap 99% of the time,
which will hash the `PropertyKey` and use it in comparisons, the
extra complexity and branching produced by lazily coercing has
become more trouble than it is worth.

Remove the lazy coercions, which then also neatly allows us to
switch to a `Variant`-based implementation.
This commit is contained in:
Jonne Ransijn 2024-12-01 00:37:09 +01:00 committed by Andreas Kling
parent 6de4f75d32
commit cfb00ba494
Notes: github-actions[bot] 2024-12-01 09:43:49 +00:00
4 changed files with 59 additions and 126 deletions

View file

@ -121,6 +121,18 @@ private:
RefPtr<RootImpl> m_impl;
};
template<class T>
inline bool operator==(Root<T> const& lhs, Root<T> const& rhs)
{
return lhs.ptr() == rhs.ptr();
}
template<class T>
inline bool operator!=(Root<T> const& lhs, Root<T> const& rhs)
{
return lhs.ptr() != rhs.ptr();
}
template<class T>
inline Root<T> make_root(T* cell, SourceLocation location = SourceLocation::current())
{