diff options
author | Andreas Kling <kling@serenityos.org> | 2021-06-03 10:46:30 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-07 18:11:59 +0200 |
commit | 69dddd4ef58e51fb0db881b3b6801492b5f86285 (patch) | |
tree | 48d9f883a18b820e96551fcfe566b7bbbc12fa84 /Userland/Libraries/LibJS/CMakeLists.txt | |
parent | f9395efaac11550d46ce6f73753e0cafc4519c57 (diff) | |
download | serenity-69dddd4ef58e51fb0db881b3b6801492b5f86285.zip |
LibJS: Start fleshing out a bytecode for the JavaScript engine :^)
This patch begins the work of implementing JavaScript execution in a
bytecode VM instead of an AST tree-walk interpreter.
It's probably quite naive, but we have to start somewhere.
The basic idea is that you call Bytecode::Generator::generate() on an
AST node and it hands you back a Bytecode::Block filled with
instructions that can then be interpreted by a Bytecode::Interpreter.
This first version only implements two instructions: Load and Add. :^)
Each bytecode block has infinity registers, and the interpreter resizes
its register file to fit the block being executed.
Two new `js` options are added in this patch as well:
`-d` will dump the generated bytecode
`-b` will execute the generated bytecode
Note that unless `-d` and/or `-b` are specified, none of the bytecode
related stuff in LibJS runs at all. This is implemented in parallel
with the existing AST interpreter. :^)
Diffstat (limited to 'Userland/Libraries/LibJS/CMakeLists.txt')
-rw-r--r-- | Userland/Libraries/LibJS/CMakeLists.txt | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/Userland/Libraries/LibJS/CMakeLists.txt b/Userland/Libraries/LibJS/CMakeLists.txt index 98459d1b6a..da9a199f63 100644 --- a/Userland/Libraries/LibJS/CMakeLists.txt +++ b/Userland/Libraries/LibJS/CMakeLists.txt @@ -1,25 +1,30 @@ set(SOURCES - AST.cpp - Console.cpp - Heap/CellAllocator.cpp - Heap/BlockAllocator.cpp - Heap/Handle.cpp - Heap/HeapBlock.cpp - Heap/Heap.cpp - Interpreter.cpp - Lexer.cpp - MarkupGenerator.cpp - Parser.cpp - Runtime/Array.cpp - Runtime/ArrayBuffer.cpp - Runtime/ArrayBufferConstructor.cpp - Runtime/ArrayBufferPrototype.cpp - Runtime/ArrayConstructor.cpp - Runtime/ArrayIterator.cpp - Runtime/ArrayIteratorPrototype.cpp - Runtime/ArrayPrototype.cpp - Runtime/BigInt.cpp - Runtime/BigIntConstructor.cpp + AST.cpp + Bytecode/Block.cpp + Bytecode/Generator.cpp + Bytecode/Instruction.cpp + Bytecode/Interpreter.cpp + Bytecode/Op.cpp + Console.cpp + Heap/CellAllocator.cpp + Heap/BlockAllocator.cpp + Heap/Handle.cpp + Heap/HeapBlock.cpp + Heap/Heap.cpp + Interpreter.cpp + Lexer.cpp + MarkupGenerator.cpp + Parser.cpp + Runtime/Array.cpp + Runtime/ArrayBuffer.cpp + Runtime/ArrayBufferConstructor.cpp + Runtime/ArrayBufferPrototype.cpp + Runtime/ArrayConstructor.cpp + Runtime/ArrayIterator.cpp + Runtime/ArrayIteratorPrototype.cpp + Runtime/ArrayPrototype.cpp + Runtime/BigInt.cpp + Runtime/BigIntConstructor.cpp Runtime/BigIntObject.cpp Runtime/BigIntPrototype.cpp Runtime/BooleanConstructor.cpp |