9.3 Execution Contexts
An execution context is a specification device that is used to track the runtime evaluation of code by an ECMAScript implementation. At any point in time, there is at most one execution context per
The execution context stack is used to track execution contexts. The
An execution context contains whatever implementation specific state is necessary to track the execution progress of its associated code. Each execution context has at least the state components listed in
|code evaluation state||
Any state needed to perform, suspend, and resume evaluation of the code associated with this
Evaluation of code by the
The value of the
Execution contexts for ECMAScript code have the additional state components listed in
The LexicalEnvironment and VariableEnvironment components of an execution context are always Environment Records.
Execution contexts representing the evaluation of generator objects have the additional state components listed in
The generator object that this
In most situations only the
An execution context is purely a specification mechanism and need not correspond to any particular artefact of an ECMAScript implementation. It is impossible for ECMAScript code to directly access or observe an execution context.
9.3.1 GetActiveScriptOrModule ( )
The abstract operation GetActiveScriptOrModule takes no arguments. It is used to determine the running script or module, based on the
9.3.2 ResolveBinding ( name [ , env ] )
The abstract operation ResolveBinding takes argument name (a String) and optional argument env (an
- If env is not present or if env is
- Set env to the
running execution context's LexicalEnvironment.
- Set env to the
Assert: env is an Environment Record.
- If the code matching the syntactic production that is being evaluated is contained in
strict mode code, let strict be true; else let strict be false.
- Return ?
GetIdentifierReference(env, name, strict).
The result of ResolveBinding is always a
9.3.3 GetThisEnvironment ( )
The loop in step
9.3.4 ResolveThisBinding ( )
The abstract operation ResolveThisBinding takes no arguments. It determines the binding of the
this using the LexicalEnvironment of the
- Let envRec be
- Return ? envRec.GetThisBinding().
9.3.5 GetNewTarget ( )
The abstract operation GetNewTarget takes no arguments. It determines the NewTarget value using the LexicalEnvironment of the
9.3.6 GetGlobalObject ( )
- Let currentRealm be
the current Realm Record.
- Return currentRealm.[[GlobalObject]].