mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
LibJS/Bytecode: Simplify Bytecode::Interpreter lifetime model
The JS::VM now owns the one Bytecode::Interpreter. We no longer have multiple bytecode interpreters, and there is no concept of a "current" bytecode interpreter. If you ask for VM::bytecode_interpreter_if_exists(), it will return null if we're not running the program in "bytecode enabled" mode. If you ask for VM::bytecode_interpreter(), it will return a bytecode interpreter in all modes. This is used for situations where even the AST interpreter switches to bytecode mode (generators, etc.)
This commit is contained in:
parent
6150960671
commit
6537ed8fff
15 changed files with 117 additions and 106 deletions
|
@ -215,12 +215,10 @@ static Result<void, TestError> run_test(StringView source, StringView filepath,
|
|||
if (program_or_error.is_error())
|
||||
return program_or_error.release_error();
|
||||
|
||||
OwnPtr<JS::Bytecode::Interpreter> bytecode_interpreter = nullptr;
|
||||
if (JS::Bytecode::Interpreter::enabled())
|
||||
bytecode_interpreter = make<JS::Bytecode::Interpreter>(realm);
|
||||
auto* bytecode_interpreter = vm->bytecode_interpreter_if_exists();
|
||||
|
||||
auto run_with_interpreter = [&](ScriptOrModuleProgram& program) {
|
||||
if (JS::Bytecode::Interpreter::enabled())
|
||||
if (bytecode_interpreter)
|
||||
return run_program(*bytecode_interpreter, program);
|
||||
return run_program(*ast_interpreter, program);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue