1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 11:55:12 +00:00

LibJS: Work-in-progress JIT compiler :^)

This commit is contained in:
Andreas Kling 2023-10-14 14:37:48 +02:00
parent f52e4fa5c2
commit babdc0a25b
11 changed files with 634 additions and 4 deletions

View file

@ -13,6 +13,7 @@
#include <LibJS/Bytecode/Instruction.h>
#include <LibJS/Bytecode/Interpreter.h>
#include <LibJS/Bytecode/Op.h>
#include <LibJS/JIT/Compiler.h>
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/BigInt.h>
@ -349,7 +350,16 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable& executa
else
push_call_frame(make<CallFrame>(), executable.number_of_registers);
run_bytecode();
if (auto native_executable = JIT::Compiler::compile(executable)) {
native_executable->run(vm());
for (size_t i = 0; i < vm().running_execution_context().local_variables.size(); ++i) {
dbgln("%{}: {}", i, vm().running_execution_context().local_variables[i]);
}
} else {
run_bytecode();
}
dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter did run unit {:p}", &executable);