mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +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:
@@ -11,7 +11,6 @@
|
||||
#include <LibJS/Runtime/FunctionEnvironment.h>
|
||||
#include <LibJS/Runtime/GlobalEnvironment.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibJS/Runtime/OrdinaryFunctionObject.h>
|
||||
#include <LibJS/Runtime/Reference.h>
|
||||
#include <LibJS/Runtime/Shape.h>
|
||||
@@ -23,7 +22,7 @@ NonnullOwnPtr<Interpreter> Interpreter::create_with_existing_global_object(Globa
|
||||
{
|
||||
DeferGC defer_gc(global_object.heap());
|
||||
auto interpreter = adopt_own(*new Interpreter(global_object.vm()));
|
||||
interpreter->m_global_object = make_handle(static_cast<Object*>(&global_object));
|
||||
interpreter->m_global_object = make_handle(&global_object);
|
||||
return interpreter;
|
||||
}
|
||||
|
||||
@@ -80,6 +79,16 @@ const GlobalObject& Interpreter::global_object() const
|
||||
return static_cast<const GlobalObject&>(*m_global_object.cell());
|
||||
}
|
||||
|
||||
Realm& Interpreter::realm()
|
||||
{
|
||||
return static_cast<Realm&>(*m_realm.cell());
|
||||
}
|
||||
|
||||
const Realm& Interpreter::realm() const
|
||||
{
|
||||
return static_cast<const Realm&>(*m_realm.cell());
|
||||
}
|
||||
|
||||
void Interpreter::enter_scope(const ScopeNode& scope_node, ScopeType scope_type, GlobalObject& global_object)
|
||||
{
|
||||
ScopeGuard guard([&] {
|
||||
|
||||
Reference in New Issue
Block a user