node
node copied to clipboard
bootstrap: make snapshot reproducible
deps: V8: cherry-pick b639938e99fa
Original commit message:
[snapshot] support context embedder data serialization
Previously all context embedder data are serialized verbatim,
so if a context embedder data slot contains a pointer, embedders
need to figure out how to store data for it on the side for the
snapshot. They also have to reset the pointers to null to make
the snapshot reproducible.
To address this issue this patch adds
v8::(Des|S)erializeContextDataCallback as part
of v8::(Des|S)erializeEmbedderFieldsCallback and use them during
(de)serialization of context embedder data. The bahavior is similar
to that of v8::(Des|S)erializeInternalFieldsCallback: If the
returned data is not empty, the returned data is going to be
written into the snapshot blob and passed to the embedder during
deserialization. Otherwise the data is serialized verbatim.
Change-Id: I4113c76fc6dc8e3503cde5533320402454e62097
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5074252
Reviewed-by: Igor Sheludko <[email protected]>
Reviewed-by: Leszek Swirski <[email protected]>
Commit-Queue: Joyee Cheung <[email protected]>
Cr-Commit-Position: refs/heads/main@{#92675}
Refs: https://github.com/v8/v8/commit/b639938e99fa6b5ffa9c859b18c72a251fd56942
deps: V8: cherry-pick 7fc698c9039d
Original commit message:
[snapshot] allow NativeContext serialization to be deferred
To serialize the context embedder data, we just need the back
reference to the embedder data array. The context can be deferred.
Bug: v8:14662
Change-Id: I6a3c9f35596cd17b7e6bc773cf598922b5b7488d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5367362
Reviewed-by: Igor Sheludko <[email protected]>
Commit-Queue: Joyee Cheung <[email protected]>
Reviewed-by: Leszek Swirski <[email protected]>
Cr-Commit-Position: refs/heads/main@{#92892}
Refs: https://github.com/v8/v8/commit/7fc698c9039dc9764512823c46d9805824ec8427
src: add utilities to help debugging reproducibility of snapshots
- Print offsets in blob serializer
- Add a special node:generate_default_snapshot ID to generate the built-in snapshot.
- Improve logging
bootstrap: make snapshot reproducible
This patch uses the new V8 API to {de}serialize context slots for snapshot in order to make the snapshot reproducible. Also added a test for the reproducibility of snapshots.
Refs: https://github.com/nodejs/build/issues/3043