[v20.x backport] cppgc related changes
deps: V8: cherry-pick 93275031284c
Original commit message:
[cppgc] expose wrapper descriptor on CppHeap
This makes it possible for embedders to:
1. Avoid creating wrapper objects that happen to have a layout that
leads V8 to consider the object cppgc-managed while it's not.
Refs: https://github.com/nodejs/node/pull/43521
2. Create cppgc-managed wrapper objects when they do not own the
CppHeap. Refs: https://github.com/nodejs/node/pull/45704
Bug: v8:13960
Change-Id: If31f4d56c5ead59dc0d56f937494d23d631f7438
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4598833
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#88490}
Refs: https://github.com/v8/v8/commit/93275031284c66be7852b13f1b18a8bbe7f3a0a9 PR-URL: https://github.com/nodejs/node/pull/48660 Reviewed-By: Chengzhong Wu legendecas@gmail.com Reviewed-By: Jiawen Geng technicalcute@gmail.com
src: use effective cppgc wrapper id to deduce non-cppgc id
Previously we hard-code a wrapper id to be used in BaseObjects to avoid accidentally triggering cppgc on these non-cppgc-managed objects, but hard-coding can be be hacky and result in mismatch when we start to create CppHeap ourselves. This patch makes it more robust by deducing non-cppgc id from the effective cppgc id, if there is one.
PR-URL: https://github.com/nodejs/node/pull/48660 Refs: https://github.com/v8/v8/commit/93275031284c66be7852b13f1b18a8bbe7f3a0a9 Reviewed-By: Chengzhong Wu legendecas@gmail.com Reviewed-By: Jiawen Geng technicalcute@gmail.com
src,tools: initialize cppgc
This patch:
- Initializes cppgc in InitializeOncePerProcess() when kNoInitializeCppgc is not set
- Create a CppHeap and attach it to the Isolate when there isn't one already during IsolateData initialization. The CppHeap is detached and terminated when IsolateData is freed.
- Publishes the cppgc headers in the tarball.
This allows C++ addons to start using cppgc to manage objects.
A helper node::SetCppgcReference() is also added to help addons enable cppgc tracing in a user-defined object.
Co-authored-by: Joyee Cheung joyeec9h3@gmail.com Refs: https://github.com/nodejs/node/issues/40786 PR-URL: https://github.com/nodejs/node/pull/45704 Refs: https://docs.google.com/document/d/1ny2Qz_EsUnXGKJRGxoA-FXIE2xpLgaMAN6jD7eAkqFQ/edit Reviewed-By: Stephen Belanger admin@stephenbelanger.com Reviewed-By: Rafael Gonzaga rafael.nunu@hotmail.com