Reland "[heap] Verify client heaps during shared GC"

This is a reland of commit ddafb7a30e

CL is relanded without changes. https://crrev.com/c/3865965 and
https://crrev.com/c/3865967 fixed the failing DCHECKs that caused
this CL to be reverted.

Original change's description:
> [heap] Verify client heaps during shared GC
>
> With --verify-heap verify all client heaps before and after a shared
> GC. This ensures that the OLD_TO_SHARED remembered set is properly
> filled for each client isolate.
>
> Bug: v8:11708
> Change-Id: I1506a419c7a91c5baa87ce251da9861d8ad9e066
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3857559
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#82829}

Bug: v8:11708
Change-Id: I38bd6724807fee36bc47d70b0d83156b81a2b4fd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3865968
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82893}
This commit is contained in:
Dominik Inführ 2022-08-30 11:50:27 +02:00 committed by V8 LUCI CQ
parent 8775410530
commit 7e4293a1fe

View File

@ -2440,12 +2440,30 @@ void Heap::PerformSharedGarbageCollection(Isolate* initiator,
if (FLAG_concurrent_marking) {
client->heap()->concurrent_marking()->Pause();
}
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {
// We don't really perform a GC here but need this scope for the nested
// SafepointScope inside Verify().
AllowGarbageCollection allow_gc;
HeapVerifier::VerifyHeap(client->heap());
}
#endif // VERIFY_HEAP
});
const GarbageCollector collector = GarbageCollector::MARK_COMPACTOR;
PerformGarbageCollection(collector, gc_reason, nullptr);
isolate()->global_safepoint()->IterateClientIsolates([](Isolate* client) {
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {
// We don't really perform a GC here but need this scope for the nested
// SafepointScope inside Verify().
AllowGarbageCollection allow_gc;
HeapVerifier::VerifyHeap(client->heap());
}
#endif // VERIFY_HEAP
if (FLAG_concurrent_marking &&
client->heap()->incremental_marking()->IsMarking()) {
client->heap()->concurrent_marking()->RescheduleJobIfNeeded();