Expand description
Node v8 module — a compatibility shim, NOT real V8 introspection.
node-js has no V8: JS is lowered to fusevm bytecode and runs on a Rust heap
(see host.rs). There is therefore no V8 heap to measure and no V8 binary
serialization format to emit. This module exists so code that calls the v8
surface (metrics collectors, v8.serialize-based caches) keeps working, with
every deviation documented rather than faked:
getHeapStatistics/getHeapSpaceStatistics/getHeapCodeStatisticsreturn the correct shape (all the keys Node produces) with zeroed values. They are not read from any live allocator — reporting a fabricated non-zero heap size would be a lie, so the honest answer is 0.serialize/deserializeround-trip through JSON, not V8’s structured-clone binary format. The returned Buffer is UTF-8 JSON bytes and is byte-incompatible with Node’sv8.serialize; it cannot carry cyclic graphs,Map/Set, typed arrays,BigInt, orundefinedthe way the real format does. Use it only for plain JSON-representable values.setFlagsFromStringis a no-op (there are no V8 flags to set).getHeapSnapshotthrows: node-js cannot produce a V8 heap snapshot.
Constants§
- DESERIALIZER_
METHODS - Methods dispatched on an
@@native = "Deserializer"object. - METHODS
- SERIALIZER_
METHODS - Methods dispatched on an
@@native = "Serializer"object (JSON-backed shim; reported to the parent forinstance_has_method/instance_callwiring).
Functions§
- call
- constant
- Non-function members of the
v8namespace, exposed as constructor values sorequire('v8').Serializer(etc.) resolve andnewreachesconstruct. Requires the parent to route"v8"intostdlib::constant. - construct
new v8.Serializer()/new v8.Deserializer(buffer)(and theDefault*aliases). node-js has no V8 structured-clone binary format, so these are JSON-backed shims: aSerializeraccumulates ONEwriteValued value as JSON and hands it back fromreleaseBufferas a UTF-8 Buffer; aDeserializerparses that JSON back withreadValue. The granular byte writers/readers (writeUint32/writeDouble/writeRawBytes/…) are NOT modeled — they only make sense against the real binary layout (see the report’s deferred list).- instance_
call - Dispatch a method on a
Serializer/Deserializerinstance.