ladybird/Libraries/LibJS/Bytecode
Andreas Kling 003589db2d LibJS: Generate C++ bytecode instruction classes from a definition file
This commit adds a new Bytecode.def file that describes all the LibJS
bytecode instructions.

From this, we are able to generate the full declarations for all C++
bytecode instruction classes, as well as their serialization code.

Note that some of the bytecode compiler was updated since instructions
no longer have default constructor arguments.

The big immediate benefit here is that we lose a couple thousand lines
of hand-written C++ code. Going forward, this also allows us to do more
tooling for the bytecode VM, now that we have an authoritative
description of its instructions.

Key things to know about:

- Instructions can inherit from one another. At the moment, everything
  simply inherits from the base "Instruction".

- @terminator means the instruction terminates a basic block.

- @nothrow means the instruction cannot throw. This affects how the
  interpreter interacts with it.

- Variable-length instructions are automatically supported. Just put an
  array of something as the last field of the instruction.

- The m_length field is magical. If present, it will be populated with
  the full length of the instruction. This is used for variable-length
  instructions.
2025-11-21 09:46:03 +01:00
..
ASTCodegen.cpp LibJS: Generate C++ bytecode instruction classes from a definition file 2025-11-21 09:46:03 +01:00
BasicBlock.cpp
BasicBlock.h Everywhere: Slap some [[clang::lifetimebound]] where appropriate 2025-09-01 11:11:38 +02:00
Builtins.cpp
Builtins.h LibJS: Avoid function call if @@hasInstance is default implementation 2025-10-13 17:15:44 +02:00
Bytecode.def LibJS: Generate C++ bytecode instruction classes from a definition file 2025-11-21 09:46:03 +01:00
CodeGenerationError.cpp
CodeGenerationError.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
Executable.cpp LibJS: Let bytecode instructions know whether they are in strict mode 2025-10-29 21:20:10 +01:00
Executable.h LibJS: Precompute the number of regs/constants/locals in Executable 2025-10-30 08:54:45 +01:00
FormatOperand.h LibJS: Generate C++ bytecode instruction classes from a definition file 2025-11-21 09:46:03 +01:00
Generator.cpp LibJS: Generate C++ bytecode instruction classes from a definition file 2025-11-21 09:46:03 +01:00
Generator.h LibJS: Generate C++ bytecode instruction classes from a definition file 2025-11-21 09:46:03 +01:00
IdentifierTable.cpp LibJS+LibWeb+WebContent: Port JS::PropertyKey to UTF-16 2025-08-05 07:07:15 -04:00
IdentifierTable.h LibJS: Give Interpreter a direct pointer to the identifier table 2025-10-07 23:50:51 +02:00
Instruction.cpp LibJS: Remove unused InstructionStreamIterator::source_code getter 2025-04-16 10:41:44 -06:00
Instruction.h LibJS: Generate C++ bytecode instruction classes from a definition file 2025-11-21 09:46:03 +01:00
Interpreter.cpp LibJS: Generate C++ bytecode instruction classes from a definition file 2025-11-21 09:46:03 +01:00
Interpreter.h LibJS: Only assign initial "accumulator" value if actually provided 2025-11-01 08:40:32 +01:00
Label.cpp
Label.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
Operand.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
PropertyAccess.h LibJS: Track current shape dictionary generation in PropertyLookupCache 2025-10-24 15:35:04 +02:00
PutKind.h LibJS: Rename Bytecode::Op::PropertyKind => Bytecode::PutKind 2025-10-11 20:08:58 +02:00
RegexTable.cpp
RegexTable.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
Register.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
ScopedOperand.cpp
ScopedOperand.h LibJS: Revert Enable EXPLICIT_SYMBOL_EXPORT 2025-07-22 11:51:29 -04:00
StringTable.cpp LibJS+LibWeb: Port interned bytecode strings to UTF-16 2025-08-14 10:27:08 +02:00
StringTable.h LibJS+LibWeb: Port interned bytecode strings to UTF-16 2025-08-14 10:27:08 +02:00