JS Internals

Reference · 62 terms

Glossary of the abstract machine

The specification's own vocabulary as used in the chapters. Each term links to its normative definition in the ECMA-262 editors' draft; in chapter prose, a code span naming one of these terms is the same link. Chapter numbers show where the term does its work.

abstract operations

AddToKeptObjects
WeakRef.prototype.deref adds its target here so it survives the rest of the current Job. · ch. 7
ApplyStringOrNumericBinaryOperator
The shared body of + - * / % ** and the bitwise operators: ToPrimitive, string check for +, then ToNumeric and type dispatch. · ch. 1, 12
ArraySpeciesCreate
Reads this.constructor[@@species] to decide what map, filter, and slice allocate. · ch. 4
Await
PromiseResolve, PerformPromiseThen with resumption closures, then suspend the running execution context. · ch. 6
ClearKeptObjects
Empties the agent's [[KeptAlive]] list at the end of a Job; bounds how long a dereferenced WeakRef target is kept. · ch. 7
CreateDataProperty
[[DefineOwnProperty]] with a writable, enumerable, configurable data descriptor; how class fields and JSON.parse create properties. · ch. 4, 16
CreatePerIterationEnvironment
Copies a for loop's let bindings into a fresh environment each iteration, so closures capture per-iteration values. · ch. 5
CreateResolvingFunctions
The resolve/reject pair given to a Promise executor, with the thenable assimilation rule. · ch. 6
FunctionDeclarationInstantiation
Builds a call's environment: parameters, then var bindings (initialised), lexical bindings (uninitialised), then function declarations. The mechanism behind "hoisting". · ch. 5
GeneratorResume
Re-enters a suspended generator's execution context with next()'s argument as the value of the yield expression. · ch. 6
GetFunctionRealm
The realm a function object belongs to, through bound functions and proxies; decides fallback intrinsics. · ch. 9
GetIterator
Calls @@iterator (or @@asyncIterator), reads next once, and returns an Iterator Record. · ch. 1, 10
GetTemplateObject
Returns the frozen strings array for a tagged template, cached per call site in the realm's [[TemplateMap]]. · ch. 10
InitializeEnvironment
Creates a module's indirect import bindings and hoisted functions during linking. · ch. 9
InnerModuleEvaluation
Depth-first post-order evaluation with cycle handling and the async (top-level await) extension. · ch. 9
InnerModuleLinking
Depth-first pass that creates every module's environment and import bindings before any module runs. · ch. 9
InstanceofOperator
Consults @@hasInstance first, then falls back to OrdinaryHasInstance. · ch. 1, 10
IsArray
True for Array exotic objects, unwrapping Proxies; realm-independent, unlike instanceof Array. · ch. 1, 9
IsLessThan
The relational comparison: Strings by code unit, otherwise ToNumeric then numeric comparison. · ch. 1, 19
IsLooselyEqual
The == algorithm: fourteen ordered steps of type-directed coercion. · ch. 1
IsStrictlyEqual
The === algorithm: same type and same value, with NaN unequal to itself and +0 equal to -0. · ch. 1
IteratorClose
Calls the iterator's return method when a consumer exits early; runs generators' finally blocks. · ch. 6, 10
LengthOfArrayLike
ToLength(Get(obj, "length")): how every generic array method reads its receiver's length, once. · ch. 15
NewPromiseResolveThenableJob
The Job that calls a thenable's then with fresh resolving functions; the source of the extra ticks when resolving with a promise. · ch. 6
OrdinaryCallBindThis
Computes the this value for a call from [[ThisMode]]: lexical, strict, or global (with ToObject). · ch. 4
OrdinaryCreateFromConstructor
Allocates an object whose [[Prototype]] is newTarget.prototype, falling back to the constructor's realm's intrinsic. · ch. 4, 9
OrdinaryDefineOwnProperty
Default [[DefineOwnProperty]]: ValidateAndApplyPropertyDescriptor against the existing descriptor. · ch. 1, 4
OrdinaryGet
Default [[Get]]: own property, else recurse on the prototype with the same Receiver; accessors are called with this = Receiver. · ch. 3, 4
OrdinaryHasInstance
The default instanceof: walk the prototype chain looking for F.prototype. · ch. 1, 10
OrdinaryOwnPropertyKeys
Array indices ascending, then strings in creation order, then symbols in creation order. · ch. 3
OrdinarySet
Default [[Set]]: finds the property along the chain, then creates or updates on the Receiver, or calls a setter, or fails on non-writable. · ch. 4, 16
OrdinarySetWithOwnDescriptor
The body of OrdinarySet once the inherited descriptor is known; where the override mistake lives. · ch. 4, 16
OrdinaryToPrimitive
Tries valueOf then toString (or the reverse for hint string), returning the first non-Object result. · ch. 1
PerformEval
Direct and indirect eval: which environment the code sees and where its var declarations land. · ch. 5, 16
PerformPromiseThen
Registers reactions without looking up then or allocating a derived promise; how await attaches to a promise. · ch. 6
PromiseResolve
Returns a native promise unchanged if its constructor matches, otherwise wraps; the fast path await relies on. · ch. 6
RepeatMatcher
The regex quantifier semantics: greedy tries one more iteration first, lazy tries the continuation first, captures reset per iteration. · ch. 13
ResolveBinding
Identifier lookup: walk Environment Records via [[OuterEnv]] until HasBinding answers yes; returns a Reference Record. · ch. 5
ResolveExport
Follows re-export chains to the module and binding that actually define a name; detects ambiguity. · ch. 9
SameValue
Object.is: distinguishes +0 from -0 and treats NaN as equal to itself. · ch. 1
SameValueZero
SameValue except +0 equals -0; used by Map, Set, and includes. · ch. 1, 15
StringToNumber
Parses a StringNumericLiteral to the nearest double; whitespace-only is 0; anything else NaN. · ch. 12
ToInt32
ToNumber, truncate, reduce modulo 2^32, reinterpret as signed: the type behind every bitwise operator. · ch. 2, 12
ToIntegerOrInfinity
ToNumber then truncation toward zero, mapping NaN to 0 and keeping infinities; used for indices and counts. · ch. 1, 15
ToNumber
Converts any value to a Number; Strings via StringToNumber, Objects via ToPrimitive with hint number; Symbols and BigInts throw. · ch. 1, 12
ToNumeric
Like ToNumber but preserves BigInt, so arithmetic operators can dispatch on the result type. · ch. 1, 12
ToObject
Wraps a primitive in its object type; throws for undefined and null. · ch. 1, 4
ToPrimitive
Converts an Object to a primitive using @@toPrimitive or OrdinaryToPrimitive, with a hint of string, number, or default. · ch. 1
ToPropertyKey
ToPrimitive with hint string, then ToString unless the result is a Symbol. · ch. 1
ToString
Converts any value to a String; Numbers via Number::toString, Objects via ToPrimitive with hint string; Symbols throw. · ch. 1, 12

host hooks

HostEnqueuePromiseJob
How the specification hands a Job to the host; in browsers, queueMicrotask. · ch. 6
HostEnsureCanCompileStrings
The host's veto over eval and Function; how CSP blocks dynamic code. · ch. 16
HostLoadImportedModule
Fetch and parse a module specifier; defined by HTML and Node, not ECMA-262. · ch. 9
HostPromiseRejectionTracker
Notifies the host when a rejection is unhandled or later handled; the source of unhandledrejection events. · ch. 6

specification types

Agent
An execution context stack, job queue, and thread; agents in a cluster may share memory. · ch. 6, 11
Completion Record
The result of every algorithm step: normal, break, continue, return, or throw, with a value. · ch. 1
Environment Record
A scope: identifier bindings and an [[OuterEnv]] link; declarative, object, function, global, or module. · ch. 1, 5
Job
An Abstract Closure run to completion later with an empty stack; the specification's only asynchrony primitive. · ch. 6
Private Name
A globally unique key created per class evaluation for each #name; looked up by identity with no prototype walk. · ch. 4
Property Descriptor
Value/Writable or Get/Set, plus Enumerable and Configurable; possibly partial. · ch. 1, 10
Realm Record
A set of intrinsics, a global object and environment, and a template map; one per global. · ch. 9, 16
Reference Record
An evaluated assignment target: base, referenced name, strictness, and this value; the source of a call's receiver. · ch. 1, 4