1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00
serenity/Userland/Libraries/LibJS
Anonymous 745b998774 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 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.
2022-02-14 21:06:49 +00:00
..
Bytecode LibJS: More properly implement scoping rules in bytecode codegen 2022-02-13 14:41:33 +00:00
Heap LibJS: Remove MarkedValueList in favor of MarkedVector<Value> :^) 2022-02-09 12:25:27 +00:00
Runtime LibJS: Get rid of unnecessary work from canonical_numeric_index_string 2022-02-14 21:06:49 +00:00
Tests LibJS: Get rid of unnecessary work from canonical_numeric_index_string 2022-02-14 21:06:49 +00:00
AST.cpp LibJS: Replace uses of MarkedValueList with MarkedVector<Value> 2022-02-09 12:25:27 +00:00
AST.h LibJS: Implement ClassExpression::generate_bytecode() 2022-02-13 14:41:33 +00:00
CMakeLists.txt LibJS: Remove MarkedValueList in favor of MarkedVector<Value> :^) 2022-02-09 12:25:27 +00:00
Console.cpp LibJS: Implement console.time/timeLog/timeEnd() methods 2021-12-27 21:44:07 +01:00
Console.h LibJS: Implement console.time/timeLog/timeEnd() methods 2021-12-27 21:44:07 +01:00
CyclicModule.cpp LibJS+Everywhere: Remove VM::exception() and most related functions 2022-02-08 09:12:42 +00:00
CyclicModule.h LibJS: Implement the import assertions proposal 2022-01-30 17:40:20 +00:00
Forward.h LibJS: Remove MarkedValueList in favor of MarkedVector<Value> :^) 2022-02-09 12:25:27 +00:00
Interpreter.cpp LibJS+Everywhere: Remove VM::exception() and most related functions 2022-02-08 09:12:42 +00:00
Interpreter.h LibJS: Replace uses of MarkedValueList with MarkedVector<Value> 2022-02-09 12:25:27 +00:00
Lexer.cpp LibJS: Always inline Lexer::current_code_point() 2022-02-13 14:44:36 +01:00
Lexer.h LibJS: Detect invalid unicode and stop lexing at that point 2021-12-29 16:57:23 +01:00
MarkupGenerator.cpp LibJS+js: Pretty-print Date objects using the ToDateString AO 2022-01-15 20:13:48 +01:00
MarkupGenerator.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Module.cpp LibJS: Add support for JSON modules 2022-01-30 17:40:20 +00:00
Module.h LibWeb: Introduce the Environment Settings Object 2022-02-08 17:47:44 +00:00
Parser.cpp LibJS: Make more use of Token::flystring_value() 2022-02-13 14:44:36 +01:00
Parser.h LibJS: Make more use of Token::flystring_value() 2022-02-13 14:44:36 +01:00
Script.cpp LibJS: Reduce header dependency graph in Realm.h 2022-02-07 19:16:46 +01:00
Script.h LibJS: Add [[HostDefined]] internal slot to Script objects 2022-02-07 19:16:46 +01:00
SourceRange.h LibJS: Add missing headers 2021-10-06 23:52:40 +01:00
SourceTextModule.cpp LibJS+Everywhere: Remove VM::exception() and most related functions 2022-02-08 09:12:42 +00:00
SourceTextModule.h LibJS: Implement the import assertions proposal 2022-01-30 17:40:20 +00:00
SyntaxHighlighter.cpp LibJS: Remove unused header includes 2021-08-01 08:10:16 +02:00
SyntaxHighlighter.h LibWeb+LibSyntax: Implement nested syntax highlighters 2021-06-07 14:45:49 +04:30
SyntheticModule.cpp LibJS: Reduce header dependency graph in Realm.h 2022-02-07 19:16:46 +01:00
SyntheticModule.h LibJS: Add support for JSON modules 2022-01-30 17:40:20 +00:00
Token.cpp LibJS: Disallow '\8' and '\9' in strict mode due to being octal escapes 2021-11-30 17:05:32 +00:00
Token.h LibJS: Add Token::flystring_value() to produce FlyString directly 2022-02-13 14:44:36 +01:00