ladybird/Userland/Libraries/LibJS/Bytecode
Andreas Kling e46b217e42 LibJS/Bytecode: Move to a new bytecode format
This patch moves us away from the accumulator-based bytecode format to
one with explicit source and destination registers.

The new format has multiple benefits:

- ~25% faster on the Kraken and Octane benchmarks :^)
- Fewer instructions to accomplish the same thing
- Much easier for humans to read(!)

Because this change requires a fundamental shift in how bytecode is
generated, it is quite comprehensive.

Main implementation mechanism: generate_bytecode() virtual function now
takes an optional "preferred dst" operand, which allows callers to
communicate when they have an operand that would be optimal for the
result to go into. It also returns an optional "actual dst" operand,
which is where the completion value (if any) of the AST node is stored
after the node has "executed".

One thing of note that's new: because instructions can now take locals
as operands, this means we got rid of the GetLocal instruction.
A side-effect of that is we have to think about the temporal deadzone
(TDZ) a bit differently for locals (GetLocal would previously check
for empty values and interpret that as a TDZ access and throw).
We now insert special ThrowIfTDZ instructions in places where a local
access may be in the TDZ, to maintain the correct behavior.

There are a number of progressions and regressions from this test:

A number of async generator tests have been accidentally fixed while
converting the implementation to the new bytecode format. It didn't
seem useful to preserve bugs in the original code when converting it.

Some "does eval() return the correct completion value" tests have
regressed, in particular ones related to propagating the appropriate
completion after control flow statements like continue and break.
These are all fairly obscure issues, and I believe we can continue
working on them separately.

The net test262 result is a progression though. :^)
2024-02-19 21:45:27 +01:00
..
ASTCodegen.cpp LibJS/Bytecode: Move to a new bytecode format 2024-02-19 21:45:27 +01:00
BasicBlock.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
BasicBlock.h LibWeb+LibJS: Use JS::GCPtr for pointers to GC-allocated objects 2023-12-11 16:55:25 +01:00
Builtins.cpp LibJS: Introduce Builtins 2023-11-17 19:06:25 +01:00
Builtins.h LibJS/JIT: Add builtin for Math.exp() 2023-11-24 12:49:15 +01:00
CodeGenerationError.cpp LibJS: Add to_string definitions to CodeGenerationError and ParserError 2023-02-17 09:14:23 -05:00
CodeGenerationError.h LibJS: Remove unused CodeGenerationError::to_deprecated_string 2023-02-17 09:14:23 -05:00
CommonImplementations.h LibJS/Bytecode: Move to a new bytecode format 2024-02-19 21:45:27 +01:00
Executable.cpp LibJS/Bytecode: Add constants table to Bytecode::Executable 2024-02-19 21:45:27 +01:00
Executable.h LibJS/Bytecode: Add constants table to Bytecode::Executable 2024-02-19 21:45:27 +01:00
Generator.cpp LibJS/Bytecode: Move to a new bytecode format 2024-02-19 21:45:27 +01:00
Generator.h LibJS/Bytecode: Move to a new bytecode format 2024-02-19 21:45:27 +01:00
IdentifierTable.cpp LibJS: Don't worry about deduplicating bytecode string tables 2023-10-04 20:10:12 +02:00
IdentifierTable.h AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
Instruction.cpp LibJS/Bytecode: Add Bytecode::Operand 2024-02-19 21:45:27 +01:00
Instruction.h LibJS/Bytecode: Move to a new bytecode format 2024-02-19 21:45:27 +01:00
Interpreter.cpp LibJS/Bytecode: Move to a new bytecode format 2024-02-19 21:45:27 +01:00
Interpreter.h LibJS/Bytecode: Move to a new bytecode format 2024-02-19 21:45:27 +01:00
Label.h Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
Op.h LibJS/Bytecode: Move to a new bytecode format 2024-02-19 21:45:27 +01:00
Operand.h LibJS/Bytecode: Add Bytecode::Operand 2024-02-19 21:45:27 +01:00
RegexTable.cpp LibJS/Bytecode: Don't reparse regular expressions on instantiation 2023-07-13 13:30:49 +02:00
RegexTable.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Register.h LibJS: Stash thrown exception in a register before executing finalizer 2023-11-03 20:27:45 +01:00
StringTable.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
StringTable.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30