Chromium Code Reviews| Index: Source/platform/heap/ThreadState.cpp |
| diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp |
| index 079ac1912d0ce202fbbc8a761bbc15343b422211..23adf7747239f094d6fd31e4d9626a327f62459d 100644 |
| --- a/Source/platform/heap/ThreadState.cpp |
| +++ b/Source/platform/heap/ThreadState.cpp |
| @@ -648,6 +648,23 @@ bool ThreadState::shouldSchedulePreciseGC() |
| #endif |
| } |
| +bool ThreadState::shouldSchedulePreciseGCOnNavigation(float estimatedRemovalRatio) |
| +{ |
| + // Avoid potential overflow by truncating to Kb. |
| + size_t allocatedObjectSizeKb = Heap::allocatedObjectSize() >> 10; |
| + // The estimated size is updated when the main thread finishes lazy |
| + // sweeping. If this thread reaches here before the main thread finishes |
| + // lazy sweeping, the thread will use the estimated size of the last GC. |
| + size_t estimatedLiveObjectSizeKb = (estimatedLiveObjectSize() >> 10) * (1 - estimatedRemovalRatio); |
| + // Heap::markedObjectSize() may be underestimated if any thread has not |
| + // finished completeSweep(). |
| + size_t currentObjectSizeKb = currentObjectSize() >> 10; |
| + // Schedule a precise GC if Oilpan has allocated more than 1 MB since |
| + // the last GC and the current memory usage is >50% larger than |
| + // the estimated live memory usage. |
| + return allocatedObjectSizeKb >= 1024 && currentObjectSizeKb > (estimatedLiveObjectSizeKb * 3) / 2; |
| +} |
| + |
| // TODO(haraken): We should improve the GC heuristics. |
| // These heuristics affect performance significantly. |
| bool ThreadState::shouldForceConservativeGC() |
| @@ -906,7 +923,7 @@ void ThreadState::runScheduledGC(StackState stackState) |
| Heap::collectAllGarbage(); |
| break; |
| case PreciseGCScheduled: |
| - Heap::collectGarbage(NoHeapPointersOnStack, GCWithoutSweep, Heap::PreciseGC); |
| + Heap::collectGarbage(NoHeapPointersOnStack, GCWithSweep, Heap::PreciseGC); |
|
haraken
2015/08/03 01:03:59
Maybe is the regression you're observing in the sh
|
| break; |
| case IdleGCScheduled: |
| // Idle time GC will be scheduled by Blink Scheduler. |