1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:08:12 +00:00

LibJS: Allocate a Realm next to GlobalObject in Interpreter::create()

Also pass a Realm reference to the Bytecode::Interpreter constructor,
just like we pass the GlobalObject.
This commit is contained in:
Linus Groh 2021-09-11 19:36:25 +01:00
parent d9c3bafcd9
commit 2b8d5696ab
8 changed files with 54 additions and 10 deletions

View file

@ -22,9 +22,10 @@ Interpreter* Interpreter::current()
return s_current;
}
Interpreter::Interpreter(GlobalObject& global_object)
Interpreter::Interpreter(GlobalObject& global_object, Realm& realm)
: m_vm(global_object.vm())
, m_global_object(global_object)
, m_realm(realm)
{
VERIFY(!s_current);
s_current = this;

View file

@ -22,13 +22,14 @@ using RegisterWindow = Vector<Value>;
class Interpreter {
public:
explicit Interpreter(GlobalObject&);
Interpreter(GlobalObject&, Realm&);
~Interpreter();
// FIXME: Remove this thing once we don't need it anymore!
static Interpreter* current();
GlobalObject& global_object() { return m_global_object; }
Realm& realm() { return m_realm; }
VM& vm() { return m_vm; }
Value run(Bytecode::Executable const&, Bytecode::BasicBlock const* entry_point = nullptr);
@ -74,6 +75,7 @@ private:
VM& m_vm;
GlobalObject& m_global_object;
Realm& m_realm;
NonnullOwnPtrVector<RegisterWindow> m_register_windows;
Optional<BasicBlock const*> m_pending_jump;
Value m_return_value;