ladybird/Libraries/LibJS
Andreas Kling 51758f3022 LibJS: Make bytecode register allocator O(1)
Generator::allocate_register used to scan the free pool to find the
lowest-numbered register and then Vec::remove it, making every
allocation O(n) in the size of the pool. When loading https://x.com/
on my Linux machine, we spent ~800ms in this function alone!

This logic only existed to match the C++ register allocation ordering
while transitioning from C++ to Rust in the LibJS compiler, so now
we can simply get rid of it and make it instant. :^)

So drop the "always hand out the lowest-numbered free register" policy
and use the pool as a plain LIFO stack. Pushing and popping the back
of the Vec are both O(1), and peak register usage is unchanged since
the policy only affects which specific register gets reused, not how
aggressively.
2026-04-21 13:59:55 +02:00
..
AsmIntGen LibJS: Call RawNativeFunction directly from asm Call 2026-04-15 15:57:48 +02:00
Bytecode LibJS: Check TDZ state in asm environment calls 2026-04-20 11:23:34 +02:00
BytecodeDef Rust: Add a config file for rustfmt 2026-04-18 08:05:47 -04:00
Contrib/Test262 LibJS: Move bytecode interpreter state to VM 2026-04-13 18:29:43 +02:00
Heap LibJS: Eliminate GeneratorResult GC cell allocation on yield/await 2026-03-20 15:57:23 -05:00
Runtime LibJS: Refresh TypedArray cached data pointers on shared memory grow 2026-04-20 09:43:08 +02:00
Rust LibJS: Make bytecode register allocator O(1) 2026-04-21 13:59:55 +02:00
CMakeLists.txt Meta: Move most dependency checks to check_for_dependencies.cmake 2026-04-20 16:41:29 -06:00
Console.cpp LibJS+LibWeb: Make DOMException hold an [[ErrorData]] slot 2026-04-08 20:33:53 +02:00
Console.h LibJS+LibWeb: Make DOMException hold an [[ErrorData]] slot 2026-04-08 20:33:53 +02:00
CyclicModule.cpp LibWeb: Support WASM modules 2026-04-03 21:21:09 +02:00
CyclicModule.h LibWeb: Support WASM modules 2026-04-03 21:21:09 +02:00
Forward.h LibJS: Separate raw and capturing native functions 2026-04-15 15:57:48 +02:00
LocalVariable.h LibJS: Port the Identifier AST (and related) nodes to UTF-16 2025-08-13 09:56:13 -04:00
Module.cpp LibWeb: Support WASM modules 2026-04-03 21:21:09 +02:00
Module.h LibWeb: Support WASM modules 2026-04-03 21:21:09 +02:00
ModuleEntry.h LibJS: Remove C++ AST 2026-03-19 21:55:10 -05:00
ModuleLoading.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
ParserError.cpp LibJS: Port the JS lexer and parser to UTF-16 2025-08-13 09:56:13 -04:00
ParserError.h LibJS: Port the JS lexer and parser to UTF-16 2025-08-13 09:56:13 -04:00
Position.h LibJS: Store full realized SourceRange with each AST node 2025-12-29 13:36:01 +01:00
Print.cpp Everywhere: Remove ShadowRealm support 2026-04-05 13:57:58 +02:00
Print.h LibJS: Enable EXPLICIT_SYMBOL_EXPORT and annotate minimum symbol set 2025-07-22 11:51:29 -04:00
RustIntegration.cpp LibJS: Pack asm Call shared-data metadata 2026-04-14 12:37:12 +02:00
RustIntegration.h Everywhere: Remove ShadowRealm support 2026-04-05 13:57:58 +02:00
Script.cpp LibJS: Remove C++ compiler pipeline fallback paths 2026-03-19 21:55:10 -05:00
Script.h LibWeb: Support CSS modules 2026-04-03 21:21:09 +02:00
SourceCode.cpp LibJS: Cache ASCII-to-UTF-16 source conversion for Rust compilation 2026-02-25 00:00:52 +01:00
SourceCode.h LibJS: Cache ASCII-to-UTF-16 source conversion for Rust compilation 2026-02-25 00:00:52 +01:00
SourceRange.h LibJS: Remove C++ AST 2026-03-19 21:55:10 -05:00
SourceTextModule.cpp LibJS: Move bytecode interpreter state to VM 2026-04-13 18:29:43 +02:00
SourceTextModule.h LibJS: Remove C++ AST 2026-03-19 21:55:10 -05:00
SyntaxHighlighter.cpp Meta: Remove ENABLE_RUST build configuration option 2026-04-02 22:59:42 +02:00
SyntaxHighlighter.h LibJS: Enable EXPLICIT_SYMBOL_EXPORT and annotate minimum symbol set 2025-07-22 11:51:29 -04:00
SyntheticModule.cpp LibWeb: Support WASM modules 2026-04-03 21:21:09 +02:00
SyntheticModule.h LibWeb: Support WASM modules 2026-04-03 21:21:09 +02:00
Token.h LibJS: Remove C++ lexer, use Rust tokenizer for syntax highlighting 2026-03-19 21:55:10 -05:00