From: ulan Date: Tue, 4 Aug 2015 12:41:39 +0000 (-0700) Subject: Perform full GC in background idle notification. X-Git-Tag: upstream/4.7.83~1044 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9aff1d352d772ddcca8d317c31d6ced895bf115c;p=platform%2Fupstream%2Fv8.git Perform full GC in background idle notification. BUG=chromium:515873 LOG=NO Review URL: https://codereview.chromium.org/1263373002 Cr-Commit-Position: refs/heads/master@{#29996} --- diff --git a/src/heap/memory-reducer.cc b/src/heap/memory-reducer.cc index 634220d..634c625 100644 --- a/src/heap/memory-reducer.cc +++ b/src/heap/memory-reducer.cc @@ -95,13 +95,20 @@ void MemoryReducer::NotifyBackgroundIdleNotification(const Event& event) { if (old_action == kWait && state_.action == kWait && old_started_gcs + 1 == state_.started_gcs) { DCHECK(heap()->incremental_marking()->IsStopped()); - DCHECK(FLAG_incremental_marking); - heap()->StartIdleIncrementalMarking(); - if (FLAG_trace_gc_verbose) { - PrintIsolate(heap()->isolate(), - "Memory reducer: started GC #%d" - " (background idle)\n", - state_.started_gcs); + // TODO(ulan): Replace it with incremental marking GC once + // chromium:490559 is fixed. + if (event.time_ms > state_.last_gc_time_ms + kLongDelayMs) { + heap()->CollectAllGarbage(Heap::kReduceMemoryFootprintMask, + "memory reducer background GC"); + } else { + DCHECK(FLAG_incremental_marking); + heap()->StartIdleIncrementalMarking(); + if (FLAG_trace_gc_verbose) { + PrintIsolate(heap()->isolate(), + "Memory reducer: started GC #%d" + " (background idle)\n", + state_.started_gcs); + } } } }