src: fix pointer compression build
These two commits combined fix the pointer compression build. The build was broken starting in Node v21.0.0 due to upgrading past a regression first introduced in V8 11.4. See the refs for more information.
deps: V8: cherry-pick 475c8cdf9a95
Original commit message:
[ptr-compr] Fix multi-cage mode
This CL introduces PtrComprCageAccessScope which sets/restores current
thread's pointer compression cage base values. It's supposed to be used
by V8 jobs accessing V8 heap outside of v8::Isolate::Scope or
i::LocalHeap or i::LocalIsolate scopes (they already ensure that the
cage base values are properly initialized).
For all other build modes PtrComprCageAccessScope is a no-op.
For simplicity reasons the multi-cage mode is made incompatible with
external code space.
Bug: v8:13788, v8:14292
Change-Id: I06c2d19a1eb7254fa7af07a17617e22d98abea9f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4846592
Reviewed-by: Jakob Linke <jgruber@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90075}
Refs: https://github.com/v8/v8/commit/475c8cdf9a951bb06da3084794a0f659f8ef36c2
src: add IsolateScopes before using isolates
The V8 API requires entering an isolate before using it. We were often not doing this, which worked fine in practice. However when (multi-cage) pointer compression is enabled, the correct isolate needs to be active in order to decompress pointers correctly, otherwise it causes crashes.
Fix this by sprinkling in some calls to v8::Isolate::Scope::Scope where they were missing.
Tested by compiling with --experimental-enable-pointer-compression
locally and running all tests.
Refs: https://github.com/nodejs/build/issues/3204#issuecomment-1790213488 Refs: https://bugs.chromium.org/p/v8/issues/detail?id=14292