Skip to main content

Module builtins

Module builtins 

Source
Expand description

Builtin op handlers (compiler-emitted CallBuiltin ids) plus the JS standard library (console, Math, JSON, Object, array/string methods) reachable from the host. Handlers pop their arguments off the VM operand stack and return the result value, which the VM pushes back.

Constants§

OBJECT_PROTO_METHODS
The Object.prototype methods installed as thunks on the real Object.prototype object, so Object.prototype.toString.call(x) and a class prototype’s inherited hasOwnProperty both resolve through the chain.
REQUIRE_CACHE
The namespace name of the require.cache view. A Builtin rather than an object literal because the module cache is the single source of truth: a populated copy would answer reads correctly and silently ignore a delete, which is the operation the property exists for.

Functions§

call_builtin_function
Call a resolved builtin function (global or namespace.method).
call_type_method
Dispatch recv.name(args) for the built-in prototype methods.
construct_builtin
Construct via new for the builtin constructors.
define_property_pub
[[DefineOwnProperty]] reachable from crate::proxy’s no-trap forward.
delete_property
[[Delete]] (10.1.10) for an already-resolved property key: the one place delete o[k], delete o.k and Reflect.deleteProperty all go through, so the three cannot drift. Reports false for a non-configurable property (sloppy mode ignores the failure rather than throwing) and true otherwise, which is also what deleting an absent key reports.
dynamic_function
Build a callable from a complete function-expression source text — the ONE dynamic-function generator on this frontend.
error_string
A short Name: message string for an error value (used when an await rejection unwinds as a thrown error).
eval_source
eval(src). direct selects the scope the source runs in: a DIRECT eval — the literal eval(...) call form — evaluates in the CALLER’s scope, every other route to the same function value is an INDIRECT eval and evaluates in the global scope (ECMA-262 19.2.1.1 PerformEval). The two are told apart in host::call_named, which ops::CALL reaches and ops::CALL_VALUE/APPLY do not.
function_builtin_method
Function.prototype methods (call/apply/bind) plus Symbol.prototype/ generator handling done elsewhere. Returns Ok(None) if name is not one of these (so the caller can try statics).
function_ctor
new Function(p1, …, pN, body) / Function(p1, …, pN, body).
get_property
get_property_recv
[[Get]](name, receiver) — 10.1.8. receiver is the object the read STARTED from and is what a getter sees as this; it differs from recv only when the read was forwarded down a prototype chain, which is why Reflect.get(t, k, r) and a Proxy get trap’s third argument both need it. Every ordinary read passes recv itself.
has_property
key in obj respecting the prototype chain. Reports a Result because a Proxy’s has trap is user code and may throw.
install
Register every node-js builtin id on a VM.
is_known_builtin
is_object_builtin_method
namespace_property
A property on a builtin namespace object (Math.PI, Number.MAX_SAFE_INTEGER, console.log).
numeric_hook
Host callback for arithmetic fusevm cannot complete natively (a non-Int/ non-Float operand). Supplies JavaScript + concatenation and coercion.
object_builtin_method
Dispatch an Object.prototype builtin method on an object/instance.
own_descriptor_pub
[[GetOwnProperty]] reachable from crate::proxy’s no-trap forward.
private_brand_message
The TypeError a failed private brand check raises. Node words it two ways: a private METHOD or accessor names the class the receiver should have been an instance of, while a private FIELD names the member.
proto_method
Dispatch a @proto:<Ctor>:<method> thunk (a method read off a builtin prototype, e.g. Object.prototype.toString) against recv (its invoke-time this). Object.prototype.toString yields the [object Tag] brand string libraries type-check on; every other method routes through normal method dispatch on recv.
prototype_of
[[GetPrototypeOf]] (10.1.1) — the answer Object.getPrototypeOf, Reflect.getPrototypeOf and a __proto__ READ all have to agree on.
set_property_pub
[[Set]] reachable from crate::proxy’s no-trap forward, which has to land on the same path a plain o.k = v takes.