Commit ddfc5874 authored by Omer Katz's avatar Omer Katz Committed by V8 LUCI CQ

[heap] Use ManualGCScope in HeapTest.GrowAndShrinkNewSpace

Bug: v8:13185
Change-Id: Id145e76ad52469d9aa8a12c9172851b086421afd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3840217
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Auto-Submit: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82608}
parent 5ae6ca08
......@@ -1118,7 +1118,7 @@ class Heap {
V8_EXPORT_PRIVATE void FinalizeIncrementalMarkingAtomically(
GarbageCollectionReason gc_reason);
void CompleteSweepingFull();
V8_EXPORT_PRIVATE void CompleteSweepingFull();
void CompleteSweepingYoung(GarbageCollector collector);
// Ensures that sweeping is finished for that object's page.
......
......@@ -10,7 +10,6 @@
#include "include/v8-isolate.h"
#include "include/v8-object.h"
#include "src/common/assert-scope.h"
#include "src/handles/handles-inl.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/memory-chunk.h"
......@@ -182,16 +181,10 @@ TEST_F(HeapTest, HeapLayout) {
TEST_F(HeapTest, GrowAndShrinkNewSpace) {
if (FLAG_single_generation) return;
// Avoid shrinking new space in GC epilogue. This can happen if allocation
// throughput samples have been taken while executing the benchmark.
{
// Force an full GC and finish sweeping to make sure there is no active GC
// in the background while flags are updated.
CollectAllGarbage();
heap()->mark_compact_collector()->EnsureSweepingCompleted(
MarkCompactCollector::SweepingForcedFinalizationMode::kUnifiedHeap);
DisallowGarbageCollection no_gc_scope;
DCHECK(!heap()->incremental_marking()->IsRunning());
ManualGCScope manual_gc_scope(i_isolate());
// Avoid shrinking new space in GC epilogue. This can happen if allocation
// throughput samples have been taken while executing the benchmark.
FLAG_predictable = true;
FLAG_stress_concurrent_allocation = false; // For SimulateFullSpace.
}
......
......@@ -103,6 +103,8 @@ ManualGCScope::ManualGCScope(i::Isolate* isolate) {
if (isolate && isolate->heap()->incremental_marking()->IsMarking()) {
isolate->heap()->CollectGarbage(i::OLD_SPACE,
i::GarbageCollectionReason::kTesting);
// Make sure there is no concurrent sweeping running in the background.
isolate->heap()->CompleteSweepingFull();
}
i::FLAG_concurrent_marking = false;
......
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