diff options
Diffstat (limited to 'deps/v8/src/heap/read-only-heap.cc')
-rw-r--r-- | deps/v8/src/heap/read-only-heap.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/deps/v8/src/heap/read-only-heap.cc b/deps/v8/src/heap/read-only-heap.cc index 07db0d09da..9d47c6ccf9 100644 --- a/deps/v8/src/heap/read-only-heap.cc +++ b/deps/v8/src/heap/read-only-heap.cc @@ -99,6 +99,9 @@ void ReadOnlyHeap::SetUp(Isolate* isolate, artifacts = InitializeSharedReadOnlyArtifacts(); ro_heap = CreateInitalHeapForBootstrapping(isolate, artifacts); + + // Ensure the first read-only page ends up first in the cage. + ro_heap->read_only_space()->EnsurePage(); artifacts->VerifyChecksum(read_only_snapshot_data, true); } } else { @@ -117,9 +120,17 @@ void ReadOnlyHeap::DeserializeIntoIsolate(Isolate* isolate, DCHECK_NOT_NULL(read_only_snapshot_data); ReadOnlyDeserializer des(isolate, read_only_snapshot_data, can_rehash); des.DeserializeIntoIsolate(); + OnCreateRootsComplete(isolate); InitFromIsolate(isolate); } +void ReadOnlyHeap::OnCreateRootsComplete(Isolate* isolate) { + DCHECK_NOT_NULL(isolate); + DCHECK(!roots_init_complete_); + if (IsReadOnlySpaceShared()) InitializeFromIsolateRoots(isolate); + roots_init_complete_ = true; +} + void ReadOnlyHeap::OnCreateHeapObjectsComplete(Isolate* isolate) { DCHECK_NOT_NULL(isolate); InitFromIsolate(isolate); @@ -145,7 +156,8 @@ ReadOnlyHeap* ReadOnlyHeap::CreateInitalHeapForBootstrapping( } else { std::unique_ptr<SoleReadOnlyHeap> sole_ro_heap( new SoleReadOnlyHeap(ro_space)); - // The global shared ReadOnlyHeap is only used without pointer compression. + // The global shared ReadOnlyHeap is used with shared cage and if pointer + // compression is disabled. SoleReadOnlyHeap::shared_ro_heap_ = sole_ro_heap.get(); ro_heap = std::move(sole_ro_heap); } @@ -169,10 +181,9 @@ void SoleReadOnlyHeap::InitializeFromIsolateRoots(Isolate* isolate) { } void ReadOnlyHeap::InitFromIsolate(Isolate* isolate) { - DCHECK(!init_complete_); + DCHECK(roots_init_complete_); read_only_space_->ShrinkPages(); if (IsReadOnlySpaceShared()) { - InitializeFromIsolateRoots(isolate); std::shared_ptr<ReadOnlyArtifacts> artifacts( *read_only_artifacts_.Pointer()); @@ -187,7 +198,6 @@ void ReadOnlyHeap::InitFromIsolate(Isolate* isolate) { } else { read_only_space_->Seal(ReadOnlySpace::SealMode::kDoNotDetachFromHeap); } - init_complete_ = true; } void ReadOnlyHeap::OnHeapTearDown(Heap* heap) { |