mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
LibJS: Stop lazily coercing numeric PropertyKey
s
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:
parent
6de4f75d32
commit
cfb00ba494
Notes:
github-actions[bot]
2024-12-01 09:43:49 +00:00
Author: https://github.com/yyny
Commit: cfb00ba494
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2670
4 changed files with 59 additions and 126 deletions
|
@ -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())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue