1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

LibJS: Move the GlobalEnvironment from GlobalObject to Realm

This is where the spec wants to have it. Requires a couple of hacks as
currently everything that needs a Realm actually has a GlobalObject, so
we need to go via the Interpreter.
This commit is contained in:
Linus Groh 2021-09-11 20:27:36 +01:00
parent 1e79934acf
commit f29a82dd84
6 changed files with 13 additions and 16 deletions

View file

@ -12,6 +12,7 @@
#include <LibJS/Bytecode/Op.h>
#include <LibJS/Runtime/GlobalEnvironment.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Realm.h>
namespace JS::Bytecode {
@ -50,8 +51,8 @@ Value Interpreter::run(Executable const& executable, BasicBlock const* entry_poi
execution_context.this_value = &global_object();
static FlyString global_execution_context_name = "(*BC* global execution context)";
execution_context.function_name = global_execution_context_name;
execution_context.lexical_environment = &global_object().environment();
execution_context.variable_environment = &global_object().environment();
execution_context.lexical_environment = &m_realm.global_environment();
execution_context.variable_environment = &m_realm.global_environment();
VERIFY(!vm().exception());
// FIXME: How do we know if we're in strict mode? Maybe the Bytecode::Block should know this?
// execution_context.is_strict_mode = ???;