Commit 03b445c7 authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Remove ClientHeapVerifier

There is no need for ClientHeapVerifier anymore since we can simply
invoke full verification for all client heaps.

Bug: v8:13267
Change-Id: Ic72744aed09569f2e3e61bb3d6c889d2a7ad4de3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913030
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83416}
parent d76babdb
...@@ -2356,6 +2356,13 @@ size_t Heap::PerformGarbageCollection( ...@@ -2356,6 +2356,13 @@ size_t Heap::PerformGarbageCollection(
HeapVerifier::VerifyHeapIfEnabled(this); HeapVerifier::VerifyHeapIfEnabled(this);
if (isolate()->is_shared_heap_isolate()) {
isolate()->global_safepoint()->IterateClientIsolates([](Isolate* client) {
if (client->is_shared_heap_isolate()) return;
HeapVerifier::VerifyHeapIfEnabled(client->heap());
});
}
tracer()->StartInSafepoint(); tracer()->StartInSafepoint();
GarbageCollectionPrologueInSafepoint(); GarbageCollectionPrologueInSafepoint();
...@@ -2433,6 +2440,13 @@ size_t Heap::PerformGarbageCollection( ...@@ -2433,6 +2440,13 @@ size_t Heap::PerformGarbageCollection(
HeapVerifier::VerifyHeapIfEnabled(this); HeapVerifier::VerifyHeapIfEnabled(this);
if (isolate()->is_shared_heap_isolate()) {
isolate()->global_safepoint()->IterateClientIsolates([](Isolate* client) {
if (client->is_shared_heap_isolate()) return;
HeapVerifier::VerifyHeapIfEnabled(client->heap());
});
}
return freed_global_handles; return freed_global_handles;
} }
......
...@@ -4002,71 +4002,6 @@ class PointersUpdatingVisitor final : public ObjectVisitorWithCageBases, ...@@ -4002,71 +4002,6 @@ class PointersUpdatingVisitor final : public ObjectVisitorWithCageBases,
} }
}; };
#ifdef VERIFY_HEAP
// Visitor for updating root pointers and to-space pointers.
// It does not expect to encounter pointers to dead objects.
class ClientHeapVerifier final : public ObjectVisitorWithCageBases {
public:
explicit ClientHeapVerifier(Heap* heap) : ObjectVisitorWithCageBases(heap) {}
void VisitPointer(HeapObject host, ObjectSlot p) override {
VerifySlot(cage_base(), p);
}
void VisitPointer(HeapObject host, MaybeObjectSlot p) override {
VerifySlot(cage_base(), p);
}
void VisitPointers(HeapObject host, ObjectSlot start,
ObjectSlot end) override {
for (ObjectSlot p = start; p < end; ++p) {
VerifySlot(cage_base(), p);
}
}
void VisitPointers(HeapObject host, MaybeObjectSlot start,
MaybeObjectSlot end) final {
for (MaybeObjectSlot p = start; p < end; ++p) {
VerifySlot(cage_base(), p);
}
}
void VisitMapPointer(HeapObject host) override {
VerifySlot(cage_base(), host.map_slot());
}
void VisitCodePointer(HeapObject host, CodeObjectSlot slot) override {
VerifySlot(code_cage_base(), ObjectSlot(slot.address()));
}
void VisitCodeTarget(Code host, RelocInfo* rinfo) override {}
void VisitEmbeddedPointer(Code host, RelocInfo* rinfo) override {}
private:
void VerifySlot(PtrComprCageBase cage_base, ObjectSlot slot) {
HeapObject heap_object;
if (slot.load(cage_base).GetHeapObject(&heap_object)) {
VerifyHeapObject(heap_object);
}
}
void VerifySlot(PtrComprCageBase cage_base, MaybeObjectSlot slot) {
HeapObject heap_object;
if (slot.load(cage_base).GetHeapObject(&heap_object)) {
VerifyHeapObject(heap_object);
}
}
void VerifyHeapObject(HeapObject heap_object) {
if (BasicMemoryChunk::FromHeapObject(heap_object)->InReadOnlySpace())
return;
if (!heap_object.InSharedHeap()) return;
CHECK(!heap_object.map_word(kRelaxedLoad).IsForwardingAddress());
}
};
#endif // VERIFY_HEAP
static String UpdateReferenceInExternalStringTableEntry(Heap* heap, static String UpdateReferenceInExternalStringTableEntry(Heap* heap,
FullObjectSlot p) { FullObjectSlot p) {
HeapObject old_string = HeapObject::cast(*p); HeapObject old_string = HeapObject::cast(*p);
...@@ -5426,19 +5361,6 @@ void MarkCompactCollector::UpdatePointersInClientHeap(Isolate* client) { ...@@ -5426,19 +5361,6 @@ void MarkCompactCollector::UpdatePointersInClientHeap(Isolate* client) {
}); });
if (chunk->InYoungGeneration()) chunk->ReleaseTypedSlotSet<OLD_TO_SHARED>(); if (chunk->InYoungGeneration()) chunk->ReleaseTypedSlotSet<OLD_TO_SHARED>();
} }
#ifdef VERIFY_HEAP
if (v8_flags.verify_heap) {
ClientHeapVerifier verifier_visitor(client->heap());
HeapObjectIterator iterator(client->heap(),
HeapObjectIterator::kNoFiltering);
for (HeapObject obj = iterator.Next(); !obj.is_null();
obj = iterator.Next()) {
obj.IterateFast(cage_base, &verifier_visitor);
}
}
#endif // VERIFY_HEAP
} }
void MarkCompactCollector::ReportAbortedEvacuationCandidateDueToOOM( void MarkCompactCollector::ReportAbortedEvacuationCandidateDueToOOM(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment