mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 10:12:25 -05:00
745b998774
The spec version of canonical_numeric_index_string is absurdly complex, and ends up converting from a string to a number, and then back again which is both slow and also requires a few allocations and a string compare. Instead this patch moves away from using Values to represent canonical a canonical index. In most cases all we need to know is whether a PropertyKey is an integer between 0 and 2^^32-2, which we already compute when we construct a PropertyKey so the existing is_number() check is sufficient. The more expensive case is handling strings containing numbers that don't roundtrip through string conversion. In most cases these turn into regular string properties, but for TypedArray access these property names are not treated as normal named properties. TypedArrays treat these numeric properties as magic indexes that are ignored on read and are not stored (but are evaluated) on assignment. For that reason there's now a mode flag on canonical_numeric_index_string so that only TypedArrays take the cost of the ToString round trip test. In order to improve the performance of this path this patch includes some early returns to avoid conversion in cases where we can quickly know whether a property can round trip. |
||
---|---|---|
.. | ||
CallbackType.h | ||
CSSNamespace.cpp | ||
CSSNamespace.h | ||
CSSRuleWrapperFactory.cpp | ||
CSSRuleWrapperFactory.h | ||
CSSStyleDeclarationWrapperCustom.cpp | ||
EventListenerWrapper.cpp | ||
EventListenerWrapper.h | ||
EventTargetWrapperFactory.cpp | ||
EventTargetWrapperFactory.h | ||
EventWrapperFactory.cpp | ||
EventWrapperFactory.h | ||
ExceptionOrUtils.h | ||
IDLAbstractOperations.cpp | ||
IDLAbstractOperations.h | ||
ImageConstructor.cpp | ||
ImageConstructor.h | ||
LocationObject.cpp | ||
LocationObject.h | ||
MainThreadVM.cpp | ||
MainThreadVM.h | ||
NavigatorObject.cpp | ||
NavigatorObject.h | ||
NodeWrapperFactory.cpp | ||
NodeWrapperFactory.h | ||
Replaceable.h | ||
WindowObject.cpp | ||
WindowObject.h | ||
WindowObjectHelper.h | ||
Wrappable.cpp | ||
Wrappable.h | ||
Wrapper.h |