mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
LibJS: Get rid of unnecessary work from canonical_numeric_index_string
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 lets use the logic we already have as that is much more efficient. This improves performance of all non-numeric property names.
This commit is contained in:
parent
44a2ebea00
commit
3a184f7841
8 changed files with 57 additions and 98 deletions
|
@ -39,8 +39,9 @@ bool validate_and_apply_property_descriptor(Object*, PropertyKey const&, bool ex
|
|||
ThrowCompletionOr<Object*> get_prototype_from_constructor(GlobalObject&, FunctionObject const& constructor, Object* (GlobalObject::*intrinsic_default_prototype)());
|
||||
Object* create_unmapped_arguments_object(GlobalObject&, Span<Value> arguments);
|
||||
Object* create_mapped_arguments_object(GlobalObject&, FunctionObject&, Vector<FunctionNode::Parameter> const&, Span<Value> arguments, Environment&);
|
||||
Value canonical_numeric_index_string(GlobalObject&, PropertyKey const&);
|
||||
Optional<u32> canonical_numeric_index_string(PropertyKey const&);
|
||||
ThrowCompletionOr<String> get_substitution(GlobalObject&, Utf16View const& matched, Utf16View const& str, size_t position, Span<Value> captures, Value named_captures, Value replacement);
|
||||
double string_to_number(const PrimitiveString&);
|
||||
|
||||
enum class CallerMode {
|
||||
Strict,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue