Skip to content

[codex] Implement node:v8 heap snapshot and GCProfiler output - #4182

Merged
proggeramlug merged 2 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-v8-heap-snapshot
Jun 3, 2026
Merged

[codex] Implement node:v8 heap snapshot and GCProfiler output#4182
proggeramlug merged 2 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-v8-heap-snapshot

Conversation

@andrewtdiz

@andrewtdiz andrewtdiz commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Implements node:v8 heap snapshot output for getHeapSnapshot() and writeHeapSnapshot(), including readable stream/file behavior, path/options validation, and minimal heap snapshot JSON.
  • Adds stateful GCProfiler construction with start() / stop() behavior and a Node-shaped report object for namespace and named-import construction.
  • Updates the v8 runtime exports, native dispatch paths, parity documentation, and Node parity fixtures for the covered surfaces.

Issues

Closes #3140
Closes #3142

Why batched

Both changes cover node:v8 output/reporting surfaces and share the same runtime export, native dispatch, and parity documentation area. Landing them together keeps the v8 compatibility slice coherent while still leaving exact V8 internals out of scope.

Tests

  • cargo fmt --all
  • cargo fmt --all -- --check
  • git diff --check
  • git diff --cached --check
  • ./scripts/check_file_size.sh
  • RUSTC_WRAPPER= SCCACHE_DISABLE=1 CARGO_BUILD_JOBS=2 cargo check -p perry-runtime -p perry-codegen -p perry-hir
  • RUSTC_WRAPPER= SCCACHE_DISABLE=1 CARGO_BUILD_JOBS=2 cargo build --release -p perry -p perry-runtime
  • RUSTC_WRAPPER= SCCACHE_DISABLE=1 CARGO_BUILD_JOBS=2 cargo test -p perry-runtime readable_from_set_encoding_read_decodes_buffer_chunks
  • Node/Perry comparison for test-parity/node-suite/v8/gc-profiler/report-shape.ts
  • Node/Perry comparison for test-parity/node-suite/v8/heap-snapshot/output.ts
  • Node/Perry comparison for test-parity/node-suite/v8/startup-snapshot/shape.ts
  • Perry compile/run for test-parity/node-suite/v8/exports/diagnostics-surface.ts; local Node v22.22.1 lacks the startCpuProfile named export needed to run that fixture as a Node baseline.

Non-goals / limitations

  • Heap snapshot and GCProfiler outputs are minimal compatible JSON/report shapes, not exact V8 internal dumps.
  • This does not implement startup snapshot building, serializer/deserializer internals, additional heap-stat diagnostics beyond existing surfaces, promise lifecycle hooks, or CPU/heap profiling handles.

@andrewtdiz andrewtdiz changed the title [codex] Implement v8 heap snapshot output [codex] Implement node:v8 heap snapshot and GCProfiler output Jun 3, 2026
@proggeramlug
proggeramlug marked this pull request as ready for review June 3, 2026 03:13
@proggeramlug
proggeramlug merged commit 1f62e6f into PerryTS:main Jun 3, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:v8: implement GCProfiler report shape node:v8: implement heap snapshot output

2 participants