1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 17:55:06 +00:00

LibJS/Bytecode: Leave GlobalDeclarationInstantiation in C++

Don't try to implement this AO in bytecode. Instead, the bytecode
Interpreter class now has a run() API with the same inputs as the AST
interpreter. It sets up the necessary environments etc, including
invoking the GlobalDeclarationInstantiation AO.
This commit is contained in:
Andreas Kling 2023-06-15 12:36:57 +02:00
parent 32d9c8e3ca
commit d063f35afd
12 changed files with 172 additions and 284 deletions

View file

@ -36,6 +36,11 @@ public:
Realm& realm() { return m_realm; }
VM& vm() { return m_vm; }
void set_optimizations_enabled(bool);
ThrowCompletionOr<Value> run(Script&, JS::GCPtr<Environment> lexical_environment_override = nullptr);
ThrowCompletionOr<Value> run(SourceTextModule&);
ThrowCompletionOr<Value> run(Bytecode::Executable const& executable, Bytecode::BasicBlock const* entry_point = nullptr)
{
auto value_and_frame = run_and_return_frame(executable, entry_point);
@ -120,6 +125,7 @@ private:
OwnPtr<JS::Interpreter> m_ast_interpreter;
BasicBlock const* m_current_block { nullptr };
InstructionStreamIterator* m_pc { nullptr };
bool m_optimizations_enabled { false };
};
extern bool g_dump_bytecode;