The reference now carries dev's changes: tool and search arguments cross
through the host-call path (functions dropped, promises awaited, toJSON
not called), imports that can't resolve say why, namespace references are
no longer called tool references, extension arguments are passed to the
host, and an un-awaited promise's hint names load(...). The suspension
that started tools.wait inside a toJSON in tool arguments is removed: the
reference no longer calls that toJSON, so the wait never starts.
The Rust side follows in the commits after this one.
The program result's crossing runs in a native frame at the base of the
run, which a search(...) inside a toJSON there now parks with a fresh
coroutine, as a promise job's frame does.
Recorded: search parking inside a toJSON in tool arguments, in search
input and in the program's result.
The walk that crosses tool arguments, search input and the program's result to the host now calls each toJSON from a native frame it pushes, as bytecode calls it, so a toJSON can park for search(...), suspend and be saved in a snapshot. A search's walk runs in its frame and parks it with the search's frames when it awaits. The fast path makes a Date's or URL's JSON itself instead of calling the prototype's toJSON, as the reference does.
A replacer, a property list or a toJSON of the program's makes JSON.stringify run the reference's internal walk. That walk now runs in a native frame (NativeOp::Callbacks) with its containers on the frame's slots and what it wrote before each call kept in an internal byte buffer, so a toJSON or replacer can suspend there and be saved. Output, indentation, depth limits and fuel are unchanged; the native walk, which calls no program code, stays as it was. As in the reference, the walk now reads holder[key] when it reaches it, throws its own error for an un-awaited promise it reads, writes a promise a callback returns and a symbol as {}, and words the circular error with a period.
Object.fromEntries, AggregateError, Math.sumPrecise, and new URLSearchParams(...) and new Headers(...) over iterable pairs now step their iterators from native frames (NativeOp::Callbacks), so a next() or toString() of the program's can park for search(...), suspend, or be saved. Each pair of the web constructors is read by a frame of its own, pushed through a native the constructors keep as their data, so a throw there closes both iterators. Object.prototype.toLocaleString hands on to toString through the frame call and apply use, with the reference's fuel. A value that is not iterable now fails as the reference words it.
A search result's then, catch and finally act on a settled copy. They looked the method up on the copy's promise, so a program that replaced Promise.prototype.then had its function called from Rust; the reference runs the promise's own method, which only registers reactions. Now the reactions are registered directly.
Arrays, iterators, collections and other callbacks each get a native op
whose frames carry a sub-op, dispatched in the family's own file
(family_step), so a family adds steps without touching native.rs; a
snapshot saves the sub-op with the frame. enter_native_sub,
enter_for_of_sub and enter_for_of_record_sub push them.
Each family keeps its streaming cases in conformance/frames/, which
conformance/streaming.ts loads.