[heap] Require shared RO heap when using shared Isolate

The only exception is when pointer compression is on with a per-Isolate
cage.

Bug: v8:11708
Change-Id: Ice9b0114bc102c20b4151ec66a861ba673934605
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2864563
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74342}
This commit is contained in:
Shu-yu Guo 2021-05-01 08:05:38 -07:00 committed by V8 LUCI CQ
parent 39c43692c1
commit 2391742099

View File

@ -1762,6 +1762,16 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
};
void UseAsSharedIsolate() {
// When pointer compression is on with a per-Isolate cage, allocation in the
// shared Isolate can point into the per-Isolate RO heap as the offsets are
// constant across Isolates.
//
// When pointer compression is on with a shared cage or when pointer
// compression is off, a shared RO heap is required. Otherwise a shared
// allocation requested by a client Isolate could point into the client
// Isolate's RO space (e.g. an RO map) whose pages gets unmapped when it is
// disposed.
CHECK(COMPRESS_POINTERS_IN_ISOLATE_CAGE_BOOL || V8_SHARED_RO_HEAP_BOOL);
DCHECK(!is_shared_);
DCHECK_NULL(shared_isolate_);
is_shared_ = true;