Skip to main content

Module compile

Module compile 

Source
Expand description

Code compiled at run time: eval, the Function constructors, $262.evalScript and Function.prototype.toString’s source text, through the compile host the embedder installs.

The core has no front end. The embedder installs a CompileFn that compiles and lowers source into a Compiler, the part of the runtime a lowering needs (the heap, the code store, the realm), which the natives can lend while the loop holds the code store: units compiled at run time are published into the heap, which frees them once unreachable.

A compilation keeps what it makes alive until it ends: a unit published but not yet instantiated is pinned, and the atoms it interns (keys, names, string constants) are held. Before the program runs, its atoms are pinned for good instead.

Structs§

CompileError
A failed compilation: the error to throw.
CompileRequest
A compilation request.
Compiler
The runtime’s parts a compilation uses. Dropping it ends the compilation: its pinned units and held atoms are released (a Compiler::reborrow ends nothing).

Enums§

CompileKind
What to compile.

Type Aliases§

CompileFn
The embedder’s compiler: the root function of the compiled code, to be called with the global object as this.