From: mlippautz Date: Thu, 6 Aug 2015 11:49:47 +0000 (-0700) Subject: [GC] Check for incremental marking when a GC is triggered on reaching the external... X-Git-Tag: upstream/4.7.83~997 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2bd9517fefabf0d739f29b4ab61f26e88bddb0b;p=platform%2Fupstream%2Fv8.git [GC] Check for incremental marking when a GC is triggered on reaching the external allocation limit We missed a check whether we can actually do incremental marking when starting it on reaching the external allocation limit. BUG=chromium:517195 LOG=N Review URL: https://codereview.chromium.org/1274983002 Cr-Commit-Position: refs/heads/master@{#30043} --- diff --git a/src/api.cc b/src/api.cc index ef08b03..e11f366 100644 --- a/src/api.cc +++ b/src/api.cc @@ -6887,18 +6887,26 @@ Local v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) { void Isolate::CollectAllGarbage(const char* gc_reason) { i::Heap* heap = reinterpret_cast(this)->heap(); if (heap->incremental_marking()->IsStopped()) { - heap->StartIncrementalMarking(i::Heap::kNoGCFlags, kGCCallbackFlagForced, - gc_reason); - } - // TODO(mlippautz): Compute the time slice for incremental marking based on - // memory pressure. - double deadline = heap->MonotonicallyIncreasingTimeInMs() + - i::FLAG_external_allocation_limit_incremental_time; - heap->AdvanceIncrementalMarking(0, deadline, - i::IncrementalMarking::StepActions( - i::IncrementalMarking::GC_VIA_STACK_GUARD, - i::IncrementalMarking::FORCE_MARKING, - i::IncrementalMarking::FORCE_COMPLETION)); + if (heap->incremental_marking()->CanBeActivated()) { + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, kGCCallbackFlagForced, + gc_reason); + } else { + heap->CollectAllGarbage(i::Heap::kNoGCFlags, gc_reason, + kGCCallbackFlagForced); + } + } else { + // Incremental marking is turned on an has already been started. + + // TODO(mlippautz): Compute the time slice for incremental marking based on + // memory pressure. + double deadline = heap->MonotonicallyIncreasingTimeInMs() + + i::FLAG_external_allocation_limit_incremental_time; + heap->AdvanceIncrementalMarking( + 0, deadline, i::IncrementalMarking::StepActions( + i::IncrementalMarking::GC_VIA_STACK_GUARD, + i::IncrementalMarking::FORCE_MARKING, + i::IncrementalMarking::FORCE_COMPLETION)); + } } diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 9df749b..bbd4aa1 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -12574,6 +12574,17 @@ THREADED_TEST(ExternalAllocatedMemory) { } +TEST(Regress51719) { + i::FLAG_incremental_marking = false; + CcTest::InitializeVM(); + + const int64_t kTriggerGCSize = + v8::internal::Internals::kExternalAllocationLimit + 1; + v8::Isolate* isolate = CcTest::isolate(); + isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize); +} + + // Regression test for issue 54, object templates with internal fields // but no accessors or interceptors did not get their internal field // count set on instances.