Commit b3887f8a authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[cctest] Simplify the majority of callers of CcTest::CollectAllGarbage

Most callers passed kFinalizeIncrementalMarkingMask, so use that as
a default argument (not using default argument syntax to avoid including
heap.h in cctest.h).

Change-Id: I904f1eb3a0f5fdbe63eab16f6a6f01d04618645d
Reviewed-on: https://chromium-review.googlesource.com/488104Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44950}
parent 9bdabfd6
......@@ -113,6 +113,10 @@ void CcTest::CollectGarbage(i::AllocationSpace space) {
heap()->CollectGarbage(space, i::GarbageCollectionReason::kTesting);
}
void CcTest::CollectAllGarbage() {
CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
}
void CcTest::CollectAllGarbage(int flags) {
heap()->CollectAllGarbage(flags, i::GarbageCollectionReason::kTesting);
}
......
......@@ -126,6 +126,7 @@ class CcTest {
static i::Heap* heap();
static void CollectGarbage(i::AllocationSpace space);
static void CollectAllGarbage();
static void CollectAllGarbage(int flags);
static void CollectAllAvailableGarbage();
......
......@@ -132,7 +132,7 @@ TEST(ArrayBuffer_Compaction) {
heap::ForceEvacuationCandidate(page_before_gc);
CHECK(IsTracked(*buf1));
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
Page* page_after_gc = Page::FromAddress(buf1->address());
CHECK(IsTracked(*buf1));
......
......@@ -68,7 +68,7 @@ HEAP_TEST(CompactionFullAbortedPage) {
CheckAllObjectsOnPage(compaction_page_handles, to_be_aborted_page);
heap->set_force_oom(true);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
heap->mark_compact_collector()->EnsureSweepingCompleted();
// Check that all handles still point to the same page, i.e., compaction
......@@ -128,7 +128,7 @@ HEAP_TEST(CompactionPartiallyAbortedPage) {
Page::FromAddress(page_to_fill_handles.front()->address());
heap->set_force_oom(true);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
heap->mark_compact_collector()->EnsureSweepingCompleted();
bool migration_aborted = false;
......@@ -210,7 +210,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) {
Page::FromAddress(page_to_fill_handles.front()->address());
heap->set_force_oom(true);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
heap->mark_compact_collector()->EnsureSweepingCompleted();
// The following check makes sure that we compacted "some" objects, while
......@@ -303,7 +303,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) {
Page::FromAddress(page_to_fill_handles.front()->address());
heap->set_force_oom(true);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
heap->mark_compact_collector()->EnsureSweepingCompleted();
// The following check makes sure that we compacted "some" objects, while
......
This diff is collapsed.
......@@ -90,8 +90,8 @@ TEST(Promotion) {
// Array should be in the new space.
CHECK(heap->InSpace(*array, NEW_SPACE));
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
CcTest::CollectAllGarbage();
CHECK(heap->InSpace(*array, OLD_SPACE));
}
}
......@@ -115,8 +115,8 @@ HEAP_TEST(NoPromotion) {
heap->set_force_oom(true);
// Array should be in the new space.
CHECK(heap->InSpace(*array, NEW_SPACE));
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
CcTest::CollectAllGarbage();
CHECK(heap->InSpace(*array, NEW_SPACE));
}
}
......
......@@ -319,7 +319,7 @@ static void CheckAccessorArgsCorrect(
CHECK(info.Data()
->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("data"))
.FromJust());
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
CHECK(info.GetIsolate() == CcTest::isolate());
CHECK(info.This() == info.Holder());
CHECK(info.Data()
......
......@@ -378,7 +378,7 @@ void InterceptorHasOwnPropertyGetter(
void InterceptorHasOwnPropertyGetterGC(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
}
int query_counter_int = 0;
......
This diff is collapsed.
......@@ -1179,7 +1179,7 @@ TEST(FunctionCallSample) {
// Collect garbage that might have be generated while installing
// extensions.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
CompileRun(call_function_test_source);
v8::Local<v8::Function> function = GetFunction(env.local(), "start");
......
......@@ -384,7 +384,7 @@ void CheckDebuggerUnloaded(bool check_functions) {
CHECK(!CcTest::i_isolate()->debug()->debug_info_list_);
// Collect garbage to ensure weak handles are cleared.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
CcTest::CollectAllGarbage(Heap::kMakeHeapIterableMask);
// Iterate the heap and check that there are no debugger related objects left.
......@@ -812,7 +812,7 @@ static void DebugEventBreakPointCollectGarbage(
CcTest::CollectGarbage(v8::internal::NEW_SPACE);
} else {
// Mark sweep compact.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
}
}
}
......@@ -1223,7 +1223,7 @@ static void CallAndGC(v8::Local<v8::Context> context,
CHECK_EQ(2 + i * 3, break_point_hit_count);
// Mark sweep (and perhaps compact) and call function.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
f->Call(context, recv, 0, NULL).ToLocalChecked();
CHECK_EQ(3 + i * 3, break_point_hit_count);
}
......@@ -1947,7 +1947,7 @@ TEST(ScriptBreakPointLineTopLevel) {
->Get(context, v8_str(env->GetIsolate(), "f"))
.ToLocalChecked());
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 3, -1);
......
......@@ -220,7 +220,7 @@ TEST(VectorCallICStates) {
CHECK_EQ(GENERIC, nexus.StateFromFeedback());
// After a collection, state should remain GENERIC.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
CHECK_EQ(GENERIC, nexus.StateFromFeedback());
}
......@@ -245,7 +245,7 @@ TEST(VectorCallFeedbackForArray) {
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
CHECK(nexus.GetFeedback()->IsAllocationSite());
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
// It should stay monomorphic even after a GC.
CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
}
......@@ -359,7 +359,7 @@ TEST(VectorLoadICStates) {
CHECK(!nexus.FindFirstMap());
// After a collection, state should not be reset to PREMONOMORPHIC.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback());
}
......
......@@ -689,7 +689,7 @@ TEST(HeapSnapshotAddressReuse) {
CompileRun(
"for (var i = 0; i < 10000; ++i)\n"
" a[i] = new A();\n");
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
const v8::HeapSnapshot* snapshot2 = heap_profiler->TakeHeapSnapshot();
CHECK(ValidateSnapshot(snapshot2));
......@@ -731,7 +731,7 @@ TEST(HeapEntryIdsAndArrayShift) {
"for (var i = 0; i < 1; ++i)\n"
" a.shift();\n");
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
const v8::HeapSnapshot* snapshot2 = heap_profiler->TakeHeapSnapshot();
CHECK(ValidateSnapshot(snapshot2));
......@@ -772,7 +772,7 @@ TEST(HeapEntryIdsAndGC) {
const v8::HeapSnapshot* snapshot1 = heap_profiler->TakeHeapSnapshot();
CHECK(ValidateSnapshot(snapshot1));
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
const v8::HeapSnapshot* snapshot2 = heap_profiler->TakeHeapSnapshot();
CHECK(ValidateSnapshot(snapshot2));
......@@ -1101,7 +1101,7 @@ TEST(HeapSnapshotObjectsStats) {
// We have to call GC 6 times. In other case the garbage will be
// the reason of flakiness.
for (int i = 0; i < 6; ++i) {
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
}
v8::SnapshotObjectId initial_id;
......@@ -2905,7 +2905,7 @@ TEST(SamplingHeapProfiler) {
" eval(\"new Array(100)\");\n"
"}\n");
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
std::unique_ptr<v8::AllocationProfile> profile(
heap_profiler->GetAllocationProfile());
......
......@@ -738,7 +738,7 @@ TEST(CanonicalHandleScope) {
Handle<String> string2(*string1);
CHECK_EQ(number1.location(), number2.location());
CHECK_EQ(string1.location(), string2.location());
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
Handle<HeapNumber> number3(*number2);
Handle<String> string3(*string2);
CHECK_EQ(number1.location(), number3.location());
......
......@@ -46,7 +46,7 @@ static void SetUpNewSpaceWithPoisonedMementoAtTop() {
NewSpace* new_space = heap->new_space();
// Make sure we can allocate some objects without causing a GC later.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
// Allocate a string, the GC may suspect a memento behind the string.
Handle<SeqOneByteString> string =
......
......@@ -72,7 +72,7 @@ TEST(Create) {
}
CcTest::CollectGarbage(i::NEW_SPACE);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
// All symbols should be distinct.
for (int i = 0; i < kNumSymbols; ++i) {
......
......@@ -918,7 +918,7 @@ TEST(Regress436816) {
// Force a GC to free up space before we allocate objects whose
// mid-test states would fail heap verification.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
const int kPropsCount = kSmiValueSize * 3;
TestPropertyKind props[kPropsCount];
......@@ -955,7 +955,7 @@ TEST(Regress436816) {
CHECK(object->map()->HasFastPointerLayout());
// Trigger GCs and heap verification.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
}
......@@ -1014,7 +1014,7 @@ TEST(DescriptorArrayTrimming) {
// Call GC that should trim both |map|'s descriptor array and layout
// descriptor.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
// The unused tail of the layout descriptor is now "clean" again.
CHECK(map->layout_descriptor()->IsConsistentWithMap(*map, true));
......
......@@ -197,7 +197,7 @@ TEST(Regress2060a) {
// Force compacting garbage collection.
CHECK(FLAG_always_compact);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
}
......@@ -239,9 +239,9 @@ TEST(Regress2060b) {
// Force compacting garbage collection. The subsequent collections are used
// to verify that key references were actually updated.
CHECK(FLAG_always_compact);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
CcTest::CollectAllGarbage();
CcTest::CollectAllGarbage();
}
......@@ -259,5 +259,5 @@ TEST(Regress399527) {
// The weak map is marked black here but leaving the handle scope will make
// the object unreachable. Aborting incremental marking will clear all the
// marking bits which makes the weak map garbage.
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
}
......@@ -196,7 +196,7 @@ TEST(WeakSet_Regress2060a) {
// Force compacting garbage collection.
CHECK(FLAG_always_compact);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
}
......@@ -238,7 +238,7 @@ TEST(WeakSet_Regress2060b) {
// Force compacting garbage collection. The subsequent collections are used
// to verify that key references were actually updated.
CHECK(FLAG_always_compact);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
CcTest::CollectAllGarbage();
CcTest::CollectAllGarbage();
CcTest::CollectAllGarbage();
}
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