| Index: test/cctest/heap/test-heap.cc
|
| diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
|
| index 40789c2edc9bef11eaa307d681a2fcf2033c0172..6f951f12345689f91a0e13f1c295486c36df8985 100644
|
| --- a/test/cctest/heap/test-heap.cc
|
| +++ b/test/cctest/heap/test-heap.cc
|
| @@ -138,7 +138,7 @@ HEAP_TEST(TestNewSpaceRefsInCopiedCode) {
|
| Handle<Code> copy(tmp);
|
|
|
| CheckEmbeddedObjectsAreEqual(code, copy);
|
| - heap->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CheckEmbeddedObjectsAreEqual(code, copy);
|
| }
|
|
|
| @@ -478,12 +478,11 @@ TEST(Tagging) {
|
| TEST(GarbageCollection) {
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
|
|
| HandleScope sc(isolate);
|
| // Check GC.
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| Handle<JSGlobalObject> global(
|
| CcTest::i_isolate()->context()->global_object());
|
| @@ -510,7 +509,7 @@ TEST(GarbageCollection) {
|
| *Object::GetProperty(obj, prop_namex).ToHandleChecked());
|
| }
|
|
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| // Function should be alive.
|
| CHECK(Just(true) == JSReceiver::HasOwnProperty(global, name));
|
| @@ -529,7 +528,7 @@ TEST(GarbageCollection) {
|
| }
|
|
|
| // After gc, it should survive.
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| CHECK(Just(true) == JSReceiver::HasOwnProperty(global, obj_name));
|
| Handle<Object> obj =
|
| @@ -578,7 +577,6 @@ TEST(LocalHandles) {
|
| TEST(GlobalHandles) {
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
| GlobalHandles* global_handles = isolate->global_handles();
|
|
|
| @@ -600,7 +598,7 @@ TEST(GlobalHandles) {
|
| }
|
|
|
| // after gc, it should survive
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| CHECK((*h1)->IsString());
|
| CHECK((*h2)->IsHeapNumber());
|
| @@ -633,7 +631,6 @@ TEST(WeakGlobalHandlesScavenge) {
|
| i::FLAG_stress_compaction = false;
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
| GlobalHandles* global_handles = isolate->global_handles();
|
|
|
| @@ -658,7 +655,7 @@ TEST(WeakGlobalHandlesScavenge) {
|
| &TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
|
|
| // Scavenge treats weak pointers as normal roots.
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| CHECK((*h1)->IsString());
|
| CHECK((*h2)->IsHeapNumber());
|
| @@ -695,8 +692,8 @@ TEST(WeakGlobalHandlesMark) {
|
| }
|
|
|
| // Make sure the objects are promoted.
|
| - heap->CollectGarbage(OLD_SPACE);
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| CHECK(!heap->InNewSpace(*h1) && !heap->InNewSpace(*h2));
|
|
|
| std::pair<Handle<Object>*, int> handle_and_id(&h2, 1234);
|
| @@ -707,7 +704,7 @@ TEST(WeakGlobalHandlesMark) {
|
| CHECK(!GlobalHandles::IsNearDeath(h2.location()));
|
|
|
| // Incremental marking potentially marked handles before they turned weak.
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| CHECK((*h1)->IsString());
|
|
|
| @@ -722,7 +719,6 @@ TEST(DeleteWeakGlobalHandle) {
|
| i::FLAG_stress_compaction = false;
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
| GlobalHandles* global_handles = isolate->global_handles();
|
|
|
| @@ -743,12 +739,12 @@ TEST(DeleteWeakGlobalHandle) {
|
| v8::WeakCallbackType::kParameter);
|
|
|
| // Scanvenge does not recognize weak reference.
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| CHECK(!WeakPointerCleared);
|
|
|
| // Mark-compact treats weak reference properly.
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
|
|
| CHECK(WeakPointerCleared);
|
| }
|
| @@ -764,7 +760,7 @@ TEST(DoNotPromoteWhiteObjectsOnScavenge) {
|
|
|
| CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*white))));
|
|
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| CHECK(heap->InNewSpace(*white));
|
| }
|
| @@ -780,14 +776,15 @@ TEST(PromoteGreyOrBlackObjectsOnScavenge) {
|
|
|
| IncrementalMarking* marking = heap->incremental_marking();
|
| marking->Stop();
|
| - heap->StartIncrementalMarking();
|
| + heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| while (
|
| Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*marked)))) {
|
| marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
|
| IncrementalMarking::DO_NOT_FORCE_COMPLETION);
|
| }
|
|
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| CHECK(!heap->InNewSpace(*marked));
|
| }
|
| @@ -835,7 +832,7 @@ TEST(BytecodeArray) {
|
| // evacuation candidate.
|
| Page* evac_page = Page::FromAddress(constant_pool->address());
|
| evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING);
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // BytecodeArray should survive.
|
| CHECK_EQ(array->length(), kRawBytesSize);
|
| @@ -1305,14 +1302,20 @@ UNINITIALIZED_TEST(TestCodeFlushing) {
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // The code will survive at least two GCs.
|
| - i_isolate->heap()->CollectAllGarbage();
|
| - i_isolate->heap()->CollectAllGarbage();
|
| + i_isolate->heap()->CollectAllGarbage(
|
| + i::Heap::kFinalizeIncrementalMarkingMask,
|
| + i::GarbageCollectionReason::kTesting);
|
| + i_isolate->heap()->CollectAllGarbage(
|
| + i::Heap::kFinalizeIncrementalMarkingMask,
|
| + i::GarbageCollectionReason::kTesting);
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // Simulate several GCs that use full marking.
|
| const int kAgingThreshold = 6;
|
| for (int i = 0; i < kAgingThreshold; i++) {
|
| - i_isolate->heap()->CollectAllGarbage();
|
| + i_isolate->heap()->CollectAllGarbage(
|
| + i::Heap::kFinalizeIncrementalMarkingMask,
|
| + i::GarbageCollectionReason::kTesting);
|
| }
|
|
|
| // foo should no longer be in the compilation cache
|
| @@ -1358,12 +1361,12 @@ TEST(TestCodeFlushingPreAged) {
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // The code has been run so will survive at least one GC.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // The code was only run once, so it should be pre-aged and collected on the
|
| // next GC.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(!function->shared()->is_compiled() || function->IsOptimized());
|
|
|
| // Execute the function again twice, and ensure it is reset to the young age.
|
| @@ -1373,14 +1376,14 @@ TEST(TestCodeFlushingPreAged) {
|
| }
|
|
|
| // The code will survive at least two GC now that it is young again.
|
| - CcTest::heap()->CollectAllGarbage();
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // Simulate several GCs that use full marking.
|
| const int kAgingThreshold = 6;
|
| for (int i = 0; i < kAgingThreshold; i++) {
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
|
|
| // foo should no longer be in the compilation cache
|
| @@ -1423,15 +1426,15 @@ TEST(TestCodeFlushingIncremental) {
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // The code will survive at least two GCs.
|
| - CcTest::heap()->CollectAllGarbage();
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // Simulate several GCs that use incremental marking.
|
| const int kAgingThreshold = 6;
|
| for (int i = 0; i < kAgingThreshold; i++) {
|
| heap::SimulateIncrementalMarking(CcTest::heap());
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
| CHECK(!function->shared()->is_compiled() || function->IsOptimized());
|
| CHECK(!function->is_compiled() || function->IsOptimized());
|
| @@ -1447,7 +1450,7 @@ TEST(TestCodeFlushingIncremental) {
|
| heap::SimulateIncrementalMarking(CcTest::heap());
|
| if (!function->next_function_link()->IsUndefined(CcTest::i_isolate()))
|
| break;
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
|
|
| // Force optimization while incremental marking is active and while
|
| @@ -1457,7 +1460,7 @@ TEST(TestCodeFlushingIncremental) {
|
| }
|
|
|
| // Simulate one final GC to make sure the candidate queue is sane.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(function->shared()->is_compiled() || !function->IsOptimized());
|
| CHECK(function->is_compiled() || !function->IsOptimized());
|
| }
|
| @@ -1486,7 +1489,7 @@ TEST(TestCodeFlushingIncrementalScavenge) {
|
| Handle<String> bar_name = factory->InternalizeUtf8String("bar");
|
|
|
| // Perfrom one initial GC to enable code flushing.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // This compile will add the code to the compilation cache.
|
| { v8::HandleScope scope(CcTest::isolate());
|
| @@ -1523,10 +1526,10 @@ TEST(TestCodeFlushingIncrementalScavenge) {
|
| // perform a scavenge while incremental marking is still running.
|
| heap::SimulateIncrementalMarking(CcTest::heap(), false);
|
| *function2.location() = NULL;
|
| - CcTest::heap()->CollectGarbage(NEW_SPACE, "test scavenge while marking");
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| // Simulate one final GC to make sure the candidate queue is sane.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(!function->shared()->is_compiled() || function->IsOptimized());
|
| CHECK(!function->is_compiled() || function->IsOptimized());
|
| }
|
| @@ -1563,8 +1566,8 @@ TEST(TestCodeFlushingIncrementalAbort) {
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // The code will survive at least two GCs.
|
| - heap->CollectAllGarbage();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(function->shared()->is_compiled());
|
|
|
| // Bump the code age so that flushing is triggered.
|
| @@ -1593,7 +1596,7 @@ TEST(TestCodeFlushingIncrementalAbort) {
|
| }
|
|
|
| // Simulate one final GC to make sure the candidate queue is sane.
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(function->shared()->is_compiled() || !function->IsOptimized());
|
| CHECK(function->is_compiled() || !function->IsOptimized());
|
| }
|
| @@ -1649,7 +1652,6 @@ TEST(CompilationCacheCachingBehavior) {
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| - Heap* heap = isolate->heap();
|
| CompilationCache* compilation_cache = isolate->compilation_cache();
|
| LanguageMode language_mode = construct_language_mode(FLAG_use_strict);
|
|
|
| @@ -1680,7 +1682,7 @@ TEST(CompilationCacheCachingBehavior) {
|
| // (Unless --optimize-for-size, in which case it might get collected
|
| // immediately.)
|
| if (!FLAG_optimize_for_size) {
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| info = compilation_cache->LookupScript(
|
| source, Handle<Object>(), 0, 0,
|
| v8::ScriptOriginOptions(false, true, false), native_context,
|
| @@ -1698,7 +1700,7 @@ TEST(CompilationCacheCachingBehavior) {
|
| info.ToHandleChecked()->code()->MakeOlder(EVEN_MARKING_PARITY);
|
| }
|
|
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| // Ensure code aging cleared the entry from the cache.
|
| info = compilation_cache->LookupScript(
|
| source, Handle<Object>(), 0, 0,
|
| @@ -1761,7 +1763,6 @@ TEST(TestInternalWeakLists) {
|
| static const int kNumTestContexts = 10;
|
|
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| HandleScope scope(isolate);
|
| v8::Local<v8::Context> ctx[kNumTestContexts];
|
| if (!isolate->use_crankshaft()) return;
|
| @@ -1775,7 +1776,7 @@ TEST(TestInternalWeakLists) {
|
| // Collect garbage that might have been created by one of the
|
| // installed extensions.
|
| isolate->compilation_cache()->Clear();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| CHECK_EQ(i + 1, CountNativeContexts());
|
|
|
| @@ -1801,29 +1802,29 @@ TEST(TestInternalWeakLists) {
|
|
|
| // Scavenge treats these references as strong.
|
| for (int j = 0; j < 10; j++) {
|
| - CcTest::heap()->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| CHECK_EQ(5, CountOptimizedUserFunctions(ctx[i]));
|
| }
|
|
|
| // Mark compact handles the weak references.
|
| isolate->compilation_cache()->Clear();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK_EQ(4, CountOptimizedUserFunctions(ctx[i]));
|
|
|
| // Get rid of f3 and f5 in the same way.
|
| CompileRun("f3=null");
|
| for (int j = 0; j < 10; j++) {
|
| - CcTest::heap()->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| CHECK_EQ(4, CountOptimizedUserFunctions(ctx[i]));
|
| }
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK_EQ(3, CountOptimizedUserFunctions(ctx[i]));
|
| CompileRun("f5=null");
|
| for (int j = 0; j < 10; j++) {
|
| - CcTest::heap()->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| CHECK_EQ(3, CountOptimizedUserFunctions(ctx[i]));
|
| }
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK_EQ(2, CountOptimizedUserFunctions(ctx[i]));
|
|
|
| ctx[i]->Exit();
|
| @@ -1831,7 +1832,7 @@ TEST(TestInternalWeakLists) {
|
|
|
| // Force compilation cache cleanup.
|
| CcTest::heap()->NotifyContextDisposed(true);
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Dispose the native contexts one by one.
|
| for (int i = 0; i < kNumTestContexts; i++) {
|
| @@ -1842,12 +1843,12 @@ TEST(TestInternalWeakLists) {
|
|
|
| // Scavenge treats these references as strong.
|
| for (int j = 0; j < 10; j++) {
|
| - CcTest::heap()->CollectGarbage(i::NEW_SPACE);
|
| + CcTest::CollectGarbage(i::NEW_SPACE);
|
| CHECK_EQ(kNumTestContexts - i, CountNativeContexts());
|
| }
|
|
|
| // Mark compact handles the weak references.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK_EQ(kNumTestContexts - i - 1, CountNativeContexts());
|
| }
|
|
|
| @@ -1863,7 +1864,8 @@ static int CountNativeContextsWithGC(Isolate* isolate, int n) {
|
| Handle<Object> object(heap->native_contexts_list(), isolate);
|
| while (!object->IsUndefined(isolate)) {
|
| count++;
|
| - if (count == n) heap->CollectAllGarbage();
|
| + if (count == n)
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| object =
|
| Handle<Object>(Context::cast(*object)->next_context_link(), isolate);
|
| }
|
| @@ -1884,7 +1886,10 @@ static int CountOptimizedUserFunctionsWithGC(v8::Local<v8::Context> context,
|
| while (object->IsJSFunction() &&
|
| !Handle<JSFunction>::cast(object)->shared()->IsBuiltin()) {
|
| count++;
|
| - if (count == n) isolate->heap()->CollectAllGarbage();
|
| + if (count == n)
|
| + isolate->heap()->CollectAllGarbage(
|
| + i::Heap::kFinalizeIncrementalMarkingMask,
|
| + i::GarbageCollectionReason::kTesting);
|
| object = Handle<Object>(
|
| Object::cast(JSFunction::cast(*object)->next_function_link()),
|
| isolate);
|
| @@ -1967,7 +1972,7 @@ TEST(TestSizeOfRegExpCode) {
|
|
|
| // Get initial heap size after several full GCs, which will stabilize
|
| // the heap size and return with sweeping finished completely.
|
| - CcTest::heap()->CollectAllAvailableGarbage("initial cleanup");
|
| + CcTest::CollectAllAvailableGarbage();
|
| MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector();
|
| if (collector->sweeping_in_progress()) {
|
| collector->EnsureSweepingCompleted();
|
| @@ -1975,11 +1980,11 @@ TEST(TestSizeOfRegExpCode) {
|
| int initial_size = static_cast<int>(CcTest::heap()->SizeOfObjects());
|
|
|
| CompileRun("'foo'.match(reg_exp_source);");
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| int size_with_regexp = static_cast<int>(CcTest::heap()->SizeOfObjects());
|
|
|
| CompileRun("'foo'.match(half_size_reg_exp);");
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| int size_with_optimized_regexp =
|
| static_cast<int>(CcTest::heap()->SizeOfObjects());
|
|
|
| @@ -2005,7 +2010,7 @@ HEAP_TEST(TestSizeOfObjects) {
|
|
|
| // Get initial heap size after several full GCs, which will stabilize
|
| // the heap size and return with sweeping finished completely.
|
| - heap->CollectAllAvailableGarbage("initial cleanup");
|
| + CcTest::CollectAllAvailableGarbage();
|
| if (collector->sweeping_in_progress()) {
|
| collector->EnsureSweepingCompleted();
|
| }
|
| @@ -2026,7 +2031,7 @@ HEAP_TEST(TestSizeOfObjects) {
|
|
|
| // The heap size should go back to initial size after a full GC, even
|
| // though sweeping didn't finish yet.
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| // Normally sweeping would not be complete here, but no guarantees.
|
| CHECK_EQ(initial_size, static_cast<int>(heap->SizeOfObjects()));
|
| // Waiting for sweeper threads should not change heap size.
|
| @@ -2396,7 +2401,7 @@ TEST(GrowAndShrinkNewSpace) {
|
| CHECK(old_capacity == new_capacity);
|
|
|
| // Let the scavenger empty the new space.
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| CHECK_LE(new_space->Size(), old_capacity);
|
|
|
| // Explicitly shrinking should halve the space capacity.
|
| @@ -2430,7 +2435,7 @@ TEST(CollectingAllAvailableGarbageShrinksNewSpace) {
|
| new_capacity = new_space->TotalCapacity();
|
| CHECK(2 * old_capacity == new_capacity);
|
| FillUpNewSpace(new_space);
|
| - heap->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| new_capacity = new_space->TotalCapacity();
|
| CHECK(old_capacity == new_capacity);
|
| }
|
| @@ -2461,7 +2466,7 @@ TEST(LeakNativeContextViaMap) {
|
| v8::Local<v8::Context>::New(isolate, ctx1p)->Enter();
|
| }
|
|
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(2, NumberOfGlobalObjects());
|
|
|
| {
|
| @@ -2487,10 +2492,10 @@ TEST(LeakNativeContextViaMap) {
|
| ctx1p.Reset();
|
| isolate->ContextDisposedNotification();
|
| }
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(1, NumberOfGlobalObjects());
|
| ctx2p.Reset();
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(0, NumberOfGlobalObjects());
|
| }
|
|
|
| @@ -2510,7 +2515,7 @@ TEST(LeakNativeContextViaFunction) {
|
| v8::Local<v8::Context>::New(isolate, ctx1p)->Enter();
|
| }
|
|
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(2, NumberOfGlobalObjects());
|
|
|
| {
|
| @@ -2536,10 +2541,10 @@ TEST(LeakNativeContextViaFunction) {
|
| ctx1p.Reset();
|
| isolate->ContextDisposedNotification();
|
| }
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(1, NumberOfGlobalObjects());
|
| ctx2p.Reset();
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(0, NumberOfGlobalObjects());
|
| }
|
|
|
| @@ -2557,7 +2562,7 @@ TEST(LeakNativeContextViaMapKeyed) {
|
| v8::Local<v8::Context>::New(isolate, ctx1p)->Enter();
|
| }
|
|
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(2, NumberOfGlobalObjects());
|
|
|
| {
|
| @@ -2583,10 +2588,10 @@ TEST(LeakNativeContextViaMapKeyed) {
|
| ctx1p.Reset();
|
| isolate->ContextDisposedNotification();
|
| }
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(1, NumberOfGlobalObjects());
|
| ctx2p.Reset();
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(0, NumberOfGlobalObjects());
|
| }
|
|
|
| @@ -2604,7 +2609,7 @@ TEST(LeakNativeContextViaMapProto) {
|
| v8::Local<v8::Context>::New(isolate, ctx1p)->Enter();
|
| }
|
|
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(2, NumberOfGlobalObjects());
|
|
|
| {
|
| @@ -2634,10 +2639,10 @@ TEST(LeakNativeContextViaMapProto) {
|
| ctx1p.Reset();
|
| isolate->ContextDisposedNotification();
|
| }
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(1, NumberOfGlobalObjects());
|
| ctx2p.Reset();
|
| - CcTest::heap()->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(0, NumberOfGlobalObjects());
|
| }
|
|
|
| @@ -2668,7 +2673,8 @@ TEST(InstanceOfStubWriteBarrier) {
|
|
|
| IncrementalMarking* marking = CcTest::heap()->incremental_marking();
|
| marking->Stop();
|
| - CcTest::heap()->StartIncrementalMarking();
|
| + CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
|
|
| i::Handle<JSFunction> f = i::Handle<JSFunction>::cast(
|
| v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
|
| @@ -2695,7 +2701,7 @@ TEST(InstanceOfStubWriteBarrier) {
|
| }
|
|
|
| CcTest::heap()->incremental_marking()->set_should_hurry(true);
|
| - CcTest::heap()->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| }
|
|
|
| namespace {
|
| @@ -2741,11 +2747,12 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
|
| // Make sure incremental marking it not running.
|
| CcTest::heap()->incremental_marking()->Stop();
|
|
|
| - CcTest::heap()->StartIncrementalMarking();
|
| + CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| // The following calls will increment CcTest::heap()->global_ic_age().
|
| CcTest::isolate()->ContextDisposedNotification();
|
| heap::SimulateIncrementalMarking(CcTest::heap());
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age());
|
| CHECK_EQ(0, f->shared()->opt_count());
|
| @@ -2789,7 +2796,7 @@ TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) {
|
|
|
| // The following two calls will increment CcTest::heap()->global_ic_age().
|
| CcTest::isolate()->ContextDisposedNotification();
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age());
|
| CHECK_EQ(0, f->shared()->opt_count());
|
| @@ -2806,7 +2813,7 @@ HEAP_TEST(GCFlags) {
|
|
|
| // Set the flags to check whether we appropriately resets them after the GC.
|
| heap->set_current_gc_flags(Heap::kAbortIncrementalMarkingMask);
|
| - heap->CollectAllGarbage(Heap::kReduceMemoryFootprintMask);
|
| + CcTest::CollectAllGarbage(Heap::kReduceMemoryFootprintMask);
|
| CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_);
|
|
|
| MarkCompactCollector* collector = heap->mark_compact_collector();
|
| @@ -2816,14 +2823,15 @@ HEAP_TEST(GCFlags) {
|
|
|
| IncrementalMarking* marking = heap->incremental_marking();
|
| marking->Stop();
|
| - heap->StartIncrementalMarking(Heap::kReduceMemoryFootprintMask);
|
| + heap->StartIncrementalMarking(Heap::kReduceMemoryFootprintMask,
|
| + i::GarbageCollectionReason::kTesting);
|
| CHECK_NE(0, heap->current_gc_flags_ & Heap::kReduceMemoryFootprintMask);
|
|
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| // NewSpace scavenges should not overwrite the flags.
|
| CHECK_NE(0, heap->current_gc_flags_ & Heap::kReduceMemoryFootprintMask);
|
|
|
| - heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_);
|
| }
|
|
|
| @@ -2835,7 +2843,8 @@ TEST(IdleNotificationFinishMarking) {
|
| heap::SimulateFullSpace(CcTest::heap()->old_space());
|
| IncrementalMarking* marking = CcTest::heap()->incremental_marking();
|
| marking->Stop();
|
| - CcTest::heap()->StartIncrementalMarking();
|
| + CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
|
|
| CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count);
|
|
|
| @@ -3357,7 +3366,7 @@ TEST(Regress1465) {
|
| CHECK_EQ(transitions_count, transitions_before);
|
|
|
| heap::SimulateIncrementalMarking(CcTest::heap());
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Count number of live transitions after marking. Note that one transition
|
| // is left, because 'o' still holds an instance of one transition target.
|
| @@ -3421,7 +3430,7 @@ TEST(TransitionArrayShrinksDuringAllocToZero) {
|
| "root = new F");
|
| root = GetByName("root");
|
| AddPropertyTo(2, root, "funny");
|
| - CcTest::heap()->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| // Count number of live transitions after marking. Note that one transition
|
| // is left, because 'o' still holds an instance of one transition target.
|
| @@ -3448,7 +3457,7 @@ TEST(TransitionArrayShrinksDuringAllocToOne) {
|
|
|
| root = GetByName("root");
|
| AddPropertyTo(2, root, "funny");
|
| - CcTest::heap()->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| // Count number of live transitions after marking. Note that one transition
|
| // is left, because 'o' still holds an instance of one transition target.
|
| @@ -3475,7 +3484,7 @@ TEST(TransitionArrayShrinksDuringAllocToOnePropertyFound) {
|
|
|
| root = GetByName("root");
|
| AddPropertyTo(0, root, "prop9");
|
| - CcTest::i_isolate()->heap()->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
|
|
| // Count number of live transitions after marking. Note that one transition
|
| // is left, because 'o' still holds an instance of one transition target.
|
| @@ -3541,7 +3550,7 @@ TEST(Regress2143a) {
|
| CcTest::heap()->AgeInlineCaches();
|
|
|
| // Explicitly request GC to perform final marking step and sweeping.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| Handle<JSReceiver> root = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
|
| CcTest::global()
|
| @@ -3584,7 +3593,7 @@ TEST(Regress2143b) {
|
| CcTest::heap()->AgeInlineCaches();
|
|
|
| // Explicitly request GC to perform final marking step and sweeping.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| Handle<JSReceiver> root = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
|
| CcTest::global()
|
| @@ -3632,17 +3641,14 @@ TEST(ReleaseOverReservedPages) {
|
|
|
| // Triggering one GC will cause a lot of garbage to be discovered but
|
| // even spread across all allocated pages.
|
| - heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask,
|
| - "triggered for preparation");
|
| + CcTest::CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK_GE(overall_page_count, old_space->CountTotalPages());
|
|
|
| // Triggering subsequent GCs should cause at least half of the pages
|
| // to be released to the OS after at most two cycles.
|
| - heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask,
|
| - "triggered by test 1");
|
| + CcTest::CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK_GE(overall_page_count, old_space->CountTotalPages());
|
| - heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask,
|
| - "triggered by test 2");
|
| + CcTest::CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK_GE(overall_page_count, old_space->CountTotalPages() * 2);
|
|
|
| // Triggering a last-resort GC should cause all pages to be released to the
|
| @@ -3652,7 +3658,7 @@ TEST(ReleaseOverReservedPages) {
|
| // first page should be small in order to reduce memory used when the VM
|
| // boots, but if the 20 small arrays don't fit on the first page then that's
|
| // an indication that it is too small.
|
| - heap->CollectAllAvailableGarbage("triggered really hard");
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK_EQ(initial_page_count, old_space->CountTotalPages());
|
| }
|
|
|
| @@ -3737,7 +3743,7 @@ TEST(IncrementalMarkingPreservesMonomorphicCallIC) {
|
| CHECK(feedback_vector->Get(feedback_helper.slot(slot2))->IsWeakCell());
|
|
|
| heap::SimulateIncrementalMarking(CcTest::heap());
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| CHECK(!WeakCell::cast(feedback_vector->Get(feedback_helper.slot(slot1)))
|
| ->cleared());
|
| @@ -3794,7 +3800,7 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
|
| CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell());
|
|
|
| heap::SimulateIncrementalMarking(CcTest::heap());
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell());
|
| }
|
| @@ -3815,7 +3821,7 @@ TEST(IncrementalMarkingPreservesMonomorphicIC) {
|
| CheckVectorIC(f, 0, MONOMORPHIC);
|
|
|
| heap::SimulateIncrementalMarking(CcTest::heap());
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| CheckVectorIC(f, 0, MONOMORPHIC);
|
| }
|
| @@ -3852,7 +3858,7 @@ TEST(IncrementalMarkingPreservesPolymorphicIC) {
|
|
|
| // Fire context dispose notification.
|
| heap::SimulateIncrementalMarking(CcTest::heap());
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| CheckVectorIC(f, 0, POLYMORPHIC);
|
| }
|
| @@ -3890,7 +3896,7 @@ TEST(ContextDisposeDoesntClearPolymorphicIC) {
|
| // Fire context dispose notification.
|
| CcTest::isolate()->ContextDisposedNotification();
|
| heap::SimulateIncrementalMarking(CcTest::heap());
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| CheckVectorIC(f, 0, POLYMORPHIC);
|
| }
|
| @@ -3932,7 +3938,8 @@ void ReleaseStackTraceDataTest(v8::Isolate* isolate, const char* source,
|
| v8::Local<v8::Context> ctx = isolate->GetCurrentContext();
|
| v8::Local<v8::String> source_string =
|
| v8::String::NewExternalOneByte(isolate, resource).ToLocalChecked();
|
| - i_isolate->heap()->CollectAllAvailableGarbage();
|
| + i_isolate->heap()->CollectAllAvailableGarbage(
|
| + i::GarbageCollectionReason::kTesting);
|
| v8::Script::Compile(ctx, source_string)
|
| .ToLocalChecked()
|
| ->Run(ctx)
|
| @@ -3943,7 +3950,8 @@ void ReleaseStackTraceDataTest(v8::Isolate* isolate, const char* source,
|
| CHECK(!resource->IsDisposed());
|
|
|
| CompileRun(accessor);
|
| - i_isolate->heap()->CollectAllAvailableGarbage();
|
| + i_isolate->heap()->CollectAllAvailableGarbage(
|
| + i::GarbageCollectionReason::kTesting);
|
|
|
| // External source has been released.
|
| CHECK(resource->IsDisposed());
|
| @@ -4019,7 +4027,7 @@ TEST(Regress159140) {
|
| HandleScope scope(isolate);
|
|
|
| // Perform one initial GC to enable code flushing.
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Prepare several closures that are all eligible for code flushing
|
| // because all reachable ones are not optimized. Make sure that the
|
| @@ -4063,7 +4071,7 @@ TEST(Regress159140) {
|
| // finish the GC to complete code flushing.
|
| heap::SimulateIncrementalMarking(heap);
|
| CompileRun("%OptimizeFunctionOnNextCall(g); g(3);");
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Unoptimized code is missing and the deoptimizer will go ballistic.
|
| CompileRun("g('bozo');");
|
| @@ -4078,7 +4086,7 @@ TEST(Regress165495) {
|
| HandleScope scope(isolate);
|
|
|
| // Perform one initial GC to enable code flushing.
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Prepare an optimized closure that the optimized code map will get
|
| // populated. Then age the unoptimized code to trigger code flushing
|
| @@ -4108,7 +4116,7 @@ TEST(Regress165495) {
|
| // Simulate incremental marking so that unoptimized code is flushed
|
| // even though it still is cached in the optimized code map.
|
| heap::SimulateIncrementalMarking(heap);
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Make a new closure that will get code installed from the code map.
|
| // Unoptimized code is missing and the deoptimizer will go ballistic.
|
| @@ -4126,7 +4134,7 @@ TEST(Regress169209) {
|
| HandleScope scope(isolate);
|
|
|
| // Perform one initial GC to enable code flushing.
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Prepare a shared function info eligible for code flushing for which
|
| // the unoptimized code will be replaced during optimization.
|
| @@ -4183,7 +4191,7 @@ TEST(Regress169209) {
|
| "g(false);");
|
|
|
| // Finish garbage collection cycle.
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(shared1->code()->gc_metadata() == NULL);
|
| }
|
|
|
| @@ -4224,7 +4232,7 @@ TEST(Regress169928) {
|
| .FromJust());
|
|
|
| // First make sure we flip spaces
|
| - CcTest::heap()->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| // Allocate the object.
|
| Handle<FixedArray> array_data = factory->NewFixedArray(2, NOT_TENURED);
|
| @@ -4334,7 +4342,7 @@ TEST(Regress514122) {
|
| HandleScope scope(isolate);
|
|
|
| // Perfrom one initial GC to enable code flushing.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Prepare function whose optimized code map we can use.
|
| Handle<SharedFunctionInfo> shared;
|
| @@ -4412,7 +4420,7 @@ TEST(Regress514122) {
|
| }
|
|
|
| // Trigger a GC to flush out the bug.
|
| - heap->CollectGarbage(i::OLD_SPACE, "fire in the hole");
|
| + CcTest::CollectGarbage(i::OLD_SPACE);
|
| boomer->Print();
|
| }
|
|
|
| @@ -4426,7 +4434,6 @@ TEST(OptimizedCodeMapReuseEntries) {
|
| CcTest::InitializeVM();
|
| v8::Isolate* v8_isolate = CcTest::isolate();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| HandleScope scope(isolate);
|
|
|
| // Create 3 contexts, allow the 2nd one to be disposed, and verify that
|
| @@ -4442,7 +4449,7 @@ TEST(OptimizedCodeMapReuseEntries) {
|
| .ToLocalChecked();
|
| const char* toplevel = "foo(3); %OptimizeFunctionOnNextCall(foo); foo(3);";
|
| // Perfrom one initial GC to enable code flushing.
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| c1->Enter();
|
| indep->BindToCurrentContext()->Run(c1).ToLocalChecked();
|
| @@ -4476,7 +4483,7 @@ TEST(OptimizedCodeMapReuseEntries) {
|
| // Now, collect garbage. Context c2 should have no roots to it, and it's
|
| // entry in the optimized code map should be free for a new context.
|
| for (int i = 0; i < 4; i++) {
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
|
|
| Handle<FixedArray> optimized_code_map =
|
| @@ -4531,11 +4538,10 @@ TEST(Regress513496) {
|
| i::FLAG_allow_natives_syntax = true;
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| HandleScope scope(isolate);
|
|
|
| // Perfrom one initial GC to enable code flushing.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Prepare an optimized closure with containing an inlined function. Then age
|
| // the inlined unoptimized code to trigger code flushing but make sure the
|
| @@ -4579,7 +4585,7 @@ TEST(Regress513496) {
|
|
|
| // Finish a full GC cycle so that the unoptimized code of 'g' is flushed even
|
| // though the optimized code for 'f' is reachable via the optimized code map.
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Make a new closure that will get code installed from the code map.
|
| // Unoptimized code is missing and the deoptimizer will go ballistic.
|
| @@ -4622,7 +4628,7 @@ TEST(LargeObjectSlotRecording) {
|
| }
|
|
|
| // Move the evaucation candidate object.
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| // Verify that the pointers in the large object got updated.
|
| for (int i = 0; i < size; i += kStep) {
|
| @@ -4669,7 +4675,8 @@ TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) {
|
| "f(10 * 1024 * 1024);");
|
| IncrementalMarking* marking = CcTest::heap()->incremental_marking();
|
| if (marking->IsStopped()) {
|
| - CcTest::heap()->StartIncrementalMarking();
|
| + CcTest::heap()->StartIncrementalMarking(
|
| + i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting);
|
| }
|
| // This big step should be sufficient to mark the whole array.
|
| marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
|
| @@ -4780,7 +4787,7 @@ TEST(EnsureAllocationSiteDependentCodesProcessed) {
|
| // Now make sure that a gc should get rid of the function, even though we
|
| // still have the allocation site alive.
|
| for (int i = 0; i < 4; i++) {
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
|
|
| // The site still exists because of our global handle, but the code is no
|
| @@ -4828,7 +4835,7 @@ TEST(CellsInOptimizedCodeAreWeak) {
|
|
|
| // Now make sure that a gc should get rid of the function
|
| for (int i = 0; i < 4; i++) {
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
|
|
| CHECK(code->marked_for_deoptimization());
|
| @@ -4871,7 +4878,7 @@ TEST(ObjectsInOptimizedCodeAreWeak) {
|
|
|
| // Now make sure that a gc should get rid of the function
|
| for (int i = 0; i < 4; i++) {
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
|
|
| CHECK(code->marked_for_deoptimization());
|
| @@ -4921,8 +4928,8 @@ TEST(NewSpaceObjectsInOptimizedCode) {
|
| .ToLocalChecked())));
|
|
|
| CHECK(heap->InNewSpace(*foo));
|
| - heap->CollectGarbage(NEW_SPACE);
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| CHECK(!heap->InNewSpace(*foo));
|
| #ifdef VERIFY_HEAP
|
| heap->Verify();
|
| @@ -4933,7 +4940,7 @@ TEST(NewSpaceObjectsInOptimizedCode) {
|
|
|
| // Now make sure that a gc should get rid of the function
|
| for (int i = 0; i < 4; i++) {
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
|
|
| CHECK(code->marked_for_deoptimization());
|
| @@ -4956,7 +4963,7 @@ TEST(NoWeakHashTableLeakWithIncrementalMarking) {
|
|
|
| // Get a clean slate regarding optimized functions on the heap.
|
| i::Deoptimizer::DeoptimizeAll(isolate);
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| if (!isolate->use_crankshaft()) return;
|
| HandleScope outer_scope(heap->isolate());
|
| @@ -4980,7 +4987,7 @@ TEST(NoWeakHashTableLeakWithIncrementalMarking) {
|
| CompileRun(source.start());
|
| }
|
| // We have to abort incremental marking here to abandon black pages.
|
| - heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| }
|
| int elements = 0;
|
| if (heap->weak_object_to_code_table()->IsHashTable()) {
|
| @@ -5029,7 +5036,7 @@ TEST(NextCodeLinkIsWeak) {
|
| if (!isolate->use_crankshaft()) return;
|
| HandleScope outer_scope(heap->isolate());
|
| Handle<Code> code;
|
| - heap->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| int code_chain_length_before, code_chain_length_after;
|
| {
|
| HandleScope scope(heap->isolate());
|
| @@ -5043,7 +5050,7 @@ TEST(NextCodeLinkIsWeak) {
|
| code = scope.CloseAndEscape(Handle<Code>(immortal->code()));
|
| CompileRun("mortal = null; immortal = null;");
|
| }
|
| - heap->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| // Now mortal code should be dead.
|
| code_chain_length_after = GetCodeChainLength(*code);
|
| CHECK_EQ(code_chain_length_before - 1, code_chain_length_after);
|
| @@ -5074,7 +5081,7 @@ TEST(NextCodeLinkIsWeak2) {
|
|
|
| if (!isolate->use_crankshaft()) return;
|
| HandleScope outer_scope(heap->isolate());
|
| - heap->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| Handle<Context> context(Context::cast(heap->native_contexts_list()), isolate);
|
| Handle<Code> new_head;
|
| Handle<Object> old_head(context->get(Context::OPTIMIZED_CODE_LIST), isolate);
|
| @@ -5087,7 +5094,7 @@ TEST(NextCodeLinkIsWeak2) {
|
| context->set(Context::OPTIMIZED_CODE_LIST, *immortal);
|
| new_head = scope.CloseAndEscape(immortal);
|
| }
|
| - heap->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| // Now mortal code should be dead.
|
| CHECK_EQ(*old_head, new_head->next_code_link());
|
| }
|
| @@ -5137,8 +5144,7 @@ TEST(WeakFunctionInConstructor) {
|
| }
|
| weak_ic_cleared = false;
|
| garbage.SetWeak(&garbage, &ClearWeakIC, v8::WeakCallbackType::kParameter);
|
| - Heap* heap = CcTest::i_isolate()->heap();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(weak_ic_cleared);
|
|
|
| // We've determined the constructor in createObj has had it's weak cell
|
| @@ -5150,7 +5156,7 @@ TEST(WeakFunctionInConstructor) {
|
| Object* slot_value = feedback_vector->Get(FeedbackVectorSlot(0));
|
| CHECK(slot_value->IsWeakCell());
|
| if (WeakCell::cast(slot_value)->cleared()) break;
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
|
|
| Object* slot_value = feedback_vector->Get(FeedbackVectorSlot(0));
|
| @@ -5180,8 +5186,7 @@ void CheckWeakness(const char* source) {
|
| }
|
| weak_ic_cleared = false;
|
| garbage.SetWeak(&garbage, &ClearWeakIC, v8::WeakCallbackType::kParameter);
|
| - Heap* heap = CcTest::i_isolate()->heap();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(weak_ic_cleared);
|
| }
|
|
|
| @@ -5375,7 +5380,6 @@ TEST(MonomorphicStaysMonomorphicAfterGC) {
|
| if (FLAG_always_opt) return;
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| v8::HandleScope scope(CcTest::isolate());
|
| CompileRun(
|
| "function loadIC(obj) {"
|
| @@ -5394,7 +5398,7 @@ TEST(MonomorphicStaysMonomorphicAfterGC) {
|
| v8::HandleScope scope(CcTest::isolate());
|
| CompileRun("(testIC())");
|
| }
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CheckIC(loadIC, Code::LOAD_IC, 0, MONOMORPHIC);
|
| {
|
| v8::HandleScope scope(CcTest::isolate());
|
| @@ -5408,7 +5412,6 @@ TEST(PolymorphicStaysPolymorphicAfterGC) {
|
| if (FLAG_always_opt) return;
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| v8::HandleScope scope(CcTest::isolate());
|
| CompileRun(
|
| "function loadIC(obj) {"
|
| @@ -5430,7 +5433,7 @@ TEST(PolymorphicStaysPolymorphicAfterGC) {
|
| v8::HandleScope scope(CcTest::isolate());
|
| CompileRun("(testIC())");
|
| }
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CheckIC(loadIC, Code::LOAD_IC, 0, POLYMORPHIC);
|
| {
|
| v8::HandleScope scope(CcTest::isolate());
|
| @@ -5443,7 +5446,6 @@ TEST(PolymorphicStaysPolymorphicAfterGC) {
|
| TEST(WeakCell) {
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - v8::internal::Heap* heap = CcTest::heap();
|
| v8::internal::Factory* factory = isolate->factory();
|
|
|
| HandleScope outer_scope(isolate);
|
| @@ -5462,13 +5464,13 @@ TEST(WeakCell) {
|
| }
|
| CHECK(weak_cell1->value()->IsFixedArray());
|
| CHECK_EQ(*survivor, weak_cell2->value());
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| CHECK(weak_cell1->value()->IsFixedArray());
|
| CHECK_EQ(*survivor, weak_cell2->value());
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| CHECK(weak_cell1->value()->IsFixedArray());
|
| CHECK_EQ(*survivor, weak_cell2->value());
|
| - heap->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| CHECK(weak_cell1->cleared());
|
| CHECK_EQ(*survivor, weak_cell2->value());
|
| }
|
| @@ -5493,18 +5495,19 @@ TEST(WeakCellsWithIncrementalMarking) {
|
| CHECK(weak_cell->value()->IsFixedArray());
|
| IncrementalMarking* marking = heap->incremental_marking();
|
| if (marking->IsStopped()) {
|
| - heap->StartIncrementalMarking();
|
| + heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| }
|
| marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
|
| IncrementalMarking::FORCE_COMPLETION);
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| CHECK(weak_cell->value()->IsFixedArray());
|
| weak_cells[i] = inner_scope.CloseAndEscape(weak_cell);
|
| }
|
| // Call collect all twice to make sure that we also cleared
|
| // weak cells that were allocated on black pages.
|
| - heap->CollectAllGarbage();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK_EQ(*survivor, weak_cells[0]->value());
|
| for (int i = 1; i < N; i++) {
|
| CHECK(weak_cells[i]->cleared());
|
| @@ -5551,7 +5554,7 @@ TEST(AddInstructionChangesNewSpacePromotion) {
|
| heap->DisableInlineAllocation();
|
| heap->set_allocation_timeout(1);
|
| g->Call(env.local(), global, 1, args1).ToLocalChecked();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
|
|
|
|
| @@ -5612,7 +5615,7 @@ UNINITIALIZED_TEST(Regress538257) {
|
| ->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING);
|
| }
|
| heap::SimulateFullSpace(old_space);
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + heap->CollectGarbage(OLD_SPACE, i::GarbageCollectionReason::kTesting);
|
| // If we get this far, we've successfully aborted compaction. Any further
|
| // allocations might trigger OOM.
|
| }
|
| @@ -5708,8 +5711,8 @@ UNINITIALIZED_TEST(PromotionQueue) {
|
| CHECK(i::FLAG_min_semi_space_size * MB == new_space->TotalCapacity());
|
|
|
| // Call the scavenger two times to get an empty new space
|
| - heap->CollectGarbage(NEW_SPACE);
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
|
| + heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
|
|
|
| // First create a few objects which will survive a scavenge, and will get
|
| // promoted to the old generation later on. These objects will create
|
| @@ -5720,7 +5723,7 @@ UNINITIALIZED_TEST(PromotionQueue) {
|
| handles[i] = i_isolate->factory()->NewFixedArray(1, NOT_TENURED);
|
| }
|
|
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
|
| CHECK(i::FLAG_min_semi_space_size * MB == new_space->TotalCapacity());
|
|
|
| // Fill-up the first semi-space page.
|
| @@ -5737,7 +5740,7 @@ UNINITIALIZED_TEST(PromotionQueue) {
|
|
|
| // This scavenge will corrupt memory if the promotion queue is not
|
| // evacuated.
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
|
| }
|
| isolate->Dispose();
|
| }
|
| @@ -5780,7 +5783,8 @@ TEST(Regress388880) {
|
| // that would cause crash.
|
| IncrementalMarking* marking = CcTest::heap()->incremental_marking();
|
| marking->Stop();
|
| - CcTest::heap()->StartIncrementalMarking();
|
| + CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| CHECK(marking->IsMarking());
|
|
|
| // Now everything is set up for crashing in JSObject::MigrateFastToFast()
|
| @@ -5806,7 +5810,8 @@ TEST(Regress3631) {
|
| "}"
|
| "weak_map");
|
| if (marking->IsStopped()) {
|
| - CcTest::heap()->StartIncrementalMarking();
|
| + CcTest::heap()->StartIncrementalMarking(
|
| + i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting);
|
| }
|
| // Incrementally mark the backing store.
|
| Handle<JSReceiver> obj =
|
| @@ -5826,14 +5831,13 @@ TEST(Regress3631) {
|
| " weak_map.set(future_keys[i], i);"
|
| "}");
|
| heap->incremental_marking()->set_should_hurry(true);
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| }
|
|
|
|
|
| TEST(Regress442710) {
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
|
|
| HandleScope sc(isolate);
|
| @@ -5844,7 +5848,7 @@ TEST(Regress442710) {
|
| Handle<String> name = factory->InternalizeUtf8String("testArray");
|
| JSReceiver::SetProperty(global, name, array, SLOPPY).Check();
|
| CompileRun("testArray[0] = 1; testArray[1] = 2; testArray.shift();");
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| }
|
|
|
|
|
| @@ -5862,7 +5866,6 @@ HEAP_TEST(NumberStringCacheSize) {
|
| TEST(Regress3877) {
|
| CcTest::InitializeVM();
|
| Isolate* isolate = CcTest::i_isolate();
|
| - Heap* heap = isolate->heap();
|
| Factory* factory = isolate->factory();
|
| HandleScope scope(isolate);
|
| CompileRun("function cls() { this.x = 10; }");
|
| @@ -5880,14 +5883,14 @@ TEST(Regress3877) {
|
| "a.x = new cls();"
|
| "cls.prototype = null;");
|
| for (int i = 0; i < 4; i++) {
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
| // The map of a.x keeps prototype alive
|
| CHECK(!weak_prototype->cleared());
|
| // Change the map of a.x and make the previous map garbage collectable.
|
| CompileRun("a.x.__proto__ = {};");
|
| for (int i = 0; i < 4; i++) {
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| }
|
| CHECK(weak_prototype->cleared());
|
| }
|
| @@ -5914,11 +5917,11 @@ void CheckMapRetainingFor(int n) {
|
| CHECK(!weak_cell->cleared());
|
| for (int i = 0; i < n; i++) {
|
| heap::SimulateIncrementalMarking(heap);
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| }
|
| CHECK(!weak_cell->cleared());
|
| heap::SimulateIncrementalMarking(heap);
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| CHECK(weak_cell->cleared());
|
| }
|
|
|
| @@ -5943,14 +5946,14 @@ TEST(RegressArrayListGC) {
|
| Heap* heap = isolate->heap();
|
| AddRetainedMap(isolate, heap);
|
| Handle<Map> map = Map::Create(isolate, 1);
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| // Force GC in old space on next addition of retained map.
|
| Map::WeakCellForMap(map);
|
| heap::SimulateFullSpace(CcTest::heap()->new_space());
|
| for (int i = 0; i < 10; i++) {
|
| heap->AddRetainedMap(map);
|
| }
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| }
|
|
|
|
|
| @@ -6001,7 +6004,7 @@ static void TestRightTrimFixedTypedArray(i::ExternalArrayType type,
|
| Address next_obj_address = array->address() + array->size();
|
| CHECK(HeapObject::FromAddress(next_obj_address)->IsFiller());
|
| }
|
| - heap->CollectAllAvailableGarbage();
|
| + CcTest::CollectAllAvailableGarbage();
|
| }
|
|
|
|
|
| @@ -6058,7 +6061,7 @@ TEST(PreprocessStackTrace) {
|
| Object::GetElement(isolate, stack_trace, 3).ToHandleChecked();
|
| CHECK(code->IsCode());
|
|
|
| - isolate->heap()->CollectAllAvailableGarbage("stack trace preprocessing");
|
| + CcTest::CollectAllAvailableGarbage();
|
|
|
| Handle<Object> pos =
|
| Object::GetElement(isolate, stack_trace, 3).ToHandleChecked();
|
| @@ -6111,7 +6114,7 @@ TEST(BootstrappingExports) {
|
| utils.SetWeak(&utils, UtilsHasBeenCollected,
|
| v8::WeakCallbackType::kParameter);
|
|
|
| - CcTest::heap()->CollectAllAvailableGarbage("fire weak callbacks");
|
| + CcTest::CollectAllAvailableGarbage();
|
|
|
| CHECK(utils_has_been_collected);
|
| }
|
| @@ -6169,12 +6172,12 @@ TEST(NewSpaceAllocationCounter) {
|
| Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| size_t counter1 = heap->NewSpaceAllocationCounter();
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| const size_t kSize = 1024;
|
| AllocateInSpace(isolate, kSize, NEW_SPACE);
|
| size_t counter2 = heap->NewSpaceAllocationCounter();
|
| CHECK_EQ(kSize, counter2 - counter1);
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| size_t counter3 = heap->NewSpaceAllocationCounter();
|
| CHECK_EQ(0U, counter3 - counter2);
|
| // Test counter overflow.
|
| @@ -6196,18 +6199,18 @@ TEST(OldSpaceAllocationCounter) {
|
| Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| size_t counter1 = heap->OldGenerationAllocationCounter();
|
| - heap->CollectGarbage(NEW_SPACE);
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| const size_t kSize = 1024;
|
| AllocateInSpace(isolate, kSize, OLD_SPACE);
|
| size_t counter2 = heap->OldGenerationAllocationCounter();
|
| // TODO(ulan): replace all CHECK_LE with CHECK_EQ after v8:4148 is fixed.
|
| CHECK_LE(kSize, counter2 - counter1);
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| size_t counter3 = heap->OldGenerationAllocationCounter();
|
| CHECK_EQ(0u, counter3 - counter2);
|
| AllocateInSpace(isolate, kSize, OLD_SPACE);
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| size_t counter4 = heap->OldGenerationAllocationCounter();
|
| CHECK_LE(kSize, counter4 - counter3);
|
| // Test counter overflow.
|
| @@ -6282,7 +6285,7 @@ static void RemoveCodeAndGC(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| fun->ReplaceCode(*isolate->builtins()->CompileLazy());
|
| fun->shared()->ReplaceCode(*isolate->builtins()->CompileLazy());
|
| fun->shared()->ClearBytecodeArray(); // Bytecode is code too.
|
| - isolate->heap()->CollectAllAvailableGarbage("remove code and gc");
|
| + CcTest::CollectAllAvailableGarbage();
|
| }
|
|
|
|
|
| @@ -6369,7 +6372,7 @@ TEST(ScriptIterator) {
|
| Heap* heap = CcTest::heap();
|
| LocalContext context;
|
|
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| int script_count = 0;
|
| {
|
| @@ -6395,8 +6398,8 @@ TEST(SharedFunctionInfoIterator) {
|
| Heap* heap = CcTest::heap();
|
| LocalContext context;
|
|
|
| - heap->CollectAllGarbage();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| int sfi_count = 0;
|
| {
|
| @@ -6436,7 +6439,7 @@ TEST(Regress519319) {
|
| child.Reset(isolate, v8::Object::New(isolate));
|
|
|
| heap::SimulateFullSpace(heap->old_space());
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| {
|
| UniqueId id = MakeUniqueId(parent);
|
| isolate->SetObjectGroupId(parent, id);
|
| @@ -6445,8 +6448,10 @@ TEST(Regress519319) {
|
| // The CollectGarbage call above starts sweeper threads.
|
| // The crash will happen if the following two functions
|
| // are called before sweeping finishes.
|
| - heap->StartIncrementalMarking();
|
| - heap->FinalizeIncrementalMarkingIfComplete("test");
|
| + heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| + heap->FinalizeIncrementalMarkingIfComplete(
|
| + i::GarbageCollectionReason::kTesting);
|
| }
|
|
|
|
|
| @@ -6493,7 +6498,7 @@ HEAP_TEST(Regress587004) {
|
| for (int i = 0; i < N; i++) {
|
| array->set(i, *number);
|
| }
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| heap::SimulateFullSpace(heap->old_space());
|
| heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, N - 1);
|
| heap->mark_compact_collector()->EnsureSweepingCompleted();
|
| @@ -6509,7 +6514,7 @@ HEAP_TEST(Regress587004) {
|
| }
|
| // Re-enable old space expansion to avoid OOM crash.
|
| heap->set_force_oom(false);
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| }
|
|
|
| HEAP_TEST(Regress589413) {
|
| @@ -6521,8 +6526,8 @@ HEAP_TEST(Regress589413) {
|
| v8::HandleScope scope(CcTest::isolate());
|
| Heap* heap = CcTest::heap();
|
| // Get the heap in clean state.
|
| - heap->CollectGarbage(OLD_SPACE);
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| // Fill the new space with byte arrays with elements looking like pointers.
|
| @@ -6536,7 +6541,7 @@ HEAP_TEST(Regress589413) {
|
| handle(byte_array);
|
| }
|
| // Make sure the byte arrays will be promoted on the next GC.
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| // This number is close to large free list category threshold.
|
| const int N = 0x3eee;
|
| {
|
| @@ -6584,7 +6589,7 @@ HEAP_TEST(Regress589413) {
|
| }
|
| // Force allocation from the free list.
|
| heap->set_force_oom(true);
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| }
|
|
|
| TEST(Regress598319) {
|
| @@ -6625,7 +6630,7 @@ TEST(Regress598319) {
|
| CHECK_NOT_NULL(page);
|
|
|
| // GC to cleanup state
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| MarkCompactCollector* collector = heap->mark_compact_collector();
|
| if (collector->sweeping_in_progress()) {
|
| collector->EnsureSweepingCompleted();
|
| @@ -6642,7 +6647,8 @@ TEST(Regress598319) {
|
| IncrementalMarking* marking = heap->incremental_marking();
|
| CHECK(marking->IsMarking() || marking->IsStopped());
|
| if (marking->IsStopped()) {
|
| - heap->StartIncrementalMarking();
|
| + heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| }
|
| CHECK(marking->IsMarking());
|
|
|
| @@ -6708,7 +6714,7 @@ TEST(Regress615489) {
|
| v8::HandleScope scope(CcTest::isolate());
|
| Heap* heap = CcTest::heap();
|
| Isolate* isolate = heap->isolate();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| i::MarkCompactCollector* collector = heap->mark_compact_collector();
|
| i::IncrementalMarking* marking = heap->incremental_marking();
|
| @@ -6717,7 +6723,8 @@ TEST(Regress615489) {
|
| }
|
| CHECK(marking->IsMarking() || marking->IsStopped());
|
| if (marking->IsStopped()) {
|
| - heap->StartIncrementalMarking();
|
| + heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| }
|
| CHECK(marking->IsMarking());
|
| marking->StartBlackAllocationForTesting();
|
| @@ -6735,7 +6742,7 @@ TEST(Regress615489) {
|
| }
|
| CHECK(marking->IsComplete());
|
| intptr_t size_before = heap->SizeOfObjects();
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| intptr_t size_after = heap->SizeOfObjects();
|
| // Live size does not increase after garbage collection.
|
| CHECK_LE(size_after, size_before);
|
| @@ -6763,8 +6770,8 @@ TEST(Regress631969) {
|
| v8::HandleScope scope(CcTest::isolate());
|
| Heap* heap = CcTest::heap();
|
| // Get the heap in clean state.
|
| - heap->CollectGarbage(OLD_SPACE);
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| Isolate* isolate = CcTest::i_isolate();
|
| Factory* factory = isolate->factory();
|
| // Allocate two strings in a fresh page and mark the page as evacuation
|
| @@ -6781,8 +6788,8 @@ TEST(Regress631969) {
|
| heap::SimulateFullSpace(heap->old_space());
|
| Handle<String> s3;
|
| factory->NewConsString(s1, s2).ToHandle(&s3);
|
| - heap->CollectGarbage(NEW_SPACE);
|
| - heap->CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
| + CcTest::CollectGarbage(NEW_SPACE);
|
|
|
| // Finish incremental marking.
|
| IncrementalMarking* marking = heap->incremental_marking();
|
| @@ -6797,7 +6804,7 @@ TEST(Regress631969) {
|
| {
|
| StaticOneByteResource external_string("12345678901234");
|
| s3->MakeExternal(&external_string);
|
| - heap->CollectGarbage(OLD_SPACE);
|
| + CcTest::CollectGarbage(OLD_SPACE);
|
| }
|
| }
|
|
|
| @@ -6807,7 +6814,7 @@ TEST(LeftTrimFixedArrayInBlackArea) {
|
| v8::HandleScope scope(CcTest::isolate());
|
| Heap* heap = CcTest::heap();
|
| Isolate* isolate = heap->isolate();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| i::MarkCompactCollector* collector = heap->mark_compact_collector();
|
| i::IncrementalMarking* marking = heap->incremental_marking();
|
| @@ -6816,7 +6823,8 @@ TEST(LeftTrimFixedArrayInBlackArea) {
|
| }
|
| CHECK(marking->IsMarking() || marking->IsStopped());
|
| if (marking->IsStopped()) {
|
| - heap->StartIncrementalMarking();
|
| + heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| }
|
| CHECK(marking->IsMarking());
|
| marking->StartBlackAllocationForTesting();
|
| @@ -6844,7 +6852,7 @@ TEST(ContinuousLeftTrimFixedArrayInBlackArea) {
|
| v8::HandleScope scope(CcTest::isolate());
|
| Heap* heap = CcTest::heap();
|
| Isolate* isolate = heap->isolate();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| i::MarkCompactCollector* collector = heap->mark_compact_collector();
|
| i::IncrementalMarking* marking = heap->incremental_marking();
|
| @@ -6853,7 +6861,8 @@ TEST(ContinuousLeftTrimFixedArrayInBlackArea) {
|
| }
|
| CHECK(marking->IsMarking() || marking->IsStopped());
|
| if (marking->IsStopped()) {
|
| - heap->StartIncrementalMarking();
|
| + heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| }
|
| CHECK(marking->IsMarking());
|
| marking->StartBlackAllocationForTesting();
|
| @@ -6908,7 +6917,7 @@ TEST(ContinuousRightTrimFixedArrayInBlackArea) {
|
| v8::HandleScope scope(CcTest::isolate());
|
| Heap* heap = CcTest::heap();
|
| Isolate* isolate = heap->isolate();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| i::MarkCompactCollector* collector = heap->mark_compact_collector();
|
| i::IncrementalMarking* marking = heap->incremental_marking();
|
| @@ -6917,7 +6926,8 @@ TEST(ContinuousRightTrimFixedArrayInBlackArea) {
|
| }
|
| CHECK(marking->IsMarking() || marking->IsStopped());
|
| if (marking->IsStopped()) {
|
| - heap->StartIncrementalMarking();
|
| + heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| }
|
| CHECK(marking->IsMarking());
|
| marking->StartBlackAllocationForTesting();
|
| @@ -6966,7 +6976,7 @@ TEST(SlotFilteringAfterBlackAreas) {
|
| Heap* heap = CcTest::heap();
|
| Isolate* isolate = heap->isolate();
|
| MarkCompactCollector* mark_compact_collector = heap->mark_compact_collector();
|
| - heap->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
|
|
| i::MarkCompactCollector* collector = heap->mark_compact_collector();
|
| i::IncrementalMarking* marking = heap->incremental_marking();
|
| @@ -6975,7 +6985,8 @@ TEST(SlotFilteringAfterBlackAreas) {
|
| }
|
| CHECK(marking->IsMarking() || marking->IsStopped());
|
| if (marking->IsStopped()) {
|
| - heap->StartIncrementalMarking();
|
| + heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
|
| + i::GarbageCollectionReason::kTesting);
|
| }
|
| CHECK(marking->IsMarking());
|
| marking->StartBlackAllocationForTesting();
|
| @@ -7035,7 +7046,7 @@ TEST(UncommitUnusedLargeObjectMemory) {
|
| array->Shrink(1);
|
| CHECK(array->Size() < size_before);
|
|
|
| - CcTest::heap()->CollectAllGarbage();
|
| + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
|
| CHECK(chunk->CommittedPhysicalMemory() < committed_memory_before);
|
| size_t shrinked_size =
|
| RoundUp((array->address() - chunk->address()) + array->Size(),
|
|
|