1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

LibJS: Begin implementing GlobalEnvironmentRecord

These represent the outermost scope in the environment record
hierarchy. The spec says they should be a "composite" of two things:

- An ObjectEnvironmentRecord wrapping the global object
- A DeclarativeEnvironmentRecord for other declarations

It's not yet clear to me how this should work, so this patch only
implements the first part, an object record wrapping the global object.
This commit is contained in:
Andreas Kling 2021-06-22 17:16:08 +02:00
parent 1d20380859
commit 1f8b6ac3c3
13 changed files with 130 additions and 43 deletions

View file

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