Expand description
The JavaScript object heap and runtime, reached from fusevm through
registered builtins (register_builtin) and the strict numeric hook.
node-js owns no VM and no JIT: the compiler lowers JS to fusevm::Chunk, and
every JS-specific operation the VM can’t do natively is a builtin call that
lands here. Local variables live in Rc<RefCell> environments chained
parent-to-child, so a nested function/closure captures its enclosing scope by
reference.
Value representation:
- immediate:
Value::Float(every JS number — one IEEE-754 f64 type),Value::Bool(true/false),Value::Undef(undefined); - heap
Value::Obj(u32)handles: string, array, object, function, builtin-namespace, and the canonicalnull— the reference types.
Modules§
- binop
- Bitwise/shift op tags carried by
ops::BINOP(JS ToInt32/ToUint32 rules). - ops
- Builtin ids emitted by the compiler and registered on every VM. The compiler
(
compiler.rs) and the handler table (builtins.rs::install) must agree on these exactly. - unop
- Unary op tags carried by
ops::UNARY.
Structs§
- EnvData
- A local-variable environment, shared (by
Rc) between a frame and any nested function that captures it. - Frame
- One function activation.
- FuncDef
- A compiled function template: parameter shape + body chunk. Shared by every closure created from the same function/arrow.
- FuncVal
- A live closure value.
- JsHost
- The JavaScript runtime.
- Param
Slot - One parameter slot.
nameis the simple bound name; a destructuring pattern is lowered to a synthetic.arg{i}name plus body prologue code. - TryDef
- A compiled
try/catch/finallyblock. Bodies are bare chunks run in the current scope.
Enums§
Functions§
- call_
method recv.name(args).- call_
named - Resolve a bare name and call it (
f(args),parseInt(args)). - construct
- Construct an instance with
new— creates a fresh object, binds it asthis, runs the constructor, and returns the object (unless the constructor returns its own object). - fmt_
number - Format a JS number exactly as
Number.prototype.toStringdoes for the common range (no exponential-notation threshold handling for very large/small). - invoke
- Call any callable value.
- ref_
error - reset_
host - Reset the host to a clean slate (fresh module frame).
- run_
chunk_ on - Register every node-js builtin + the numeric hook on a VM, then run it.
- run_
main - Run the top-level program chunk.
- run_
user_ func - Execute a user function/closure body on a fresh frame.
- type_
error - with_
host - Run
fwith mutable access to the thread-local host.