Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1380)

Unified Diff: Source/platform/heap/ThreadState.cpp

Issue 1353283002: Oilpan: Schedule a conservative GC when page navigations are happening frequently (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/ThreadState.cpp
diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
index 8d2eb9f6f6f2495de33ea25adf3dc679516bd960..6b568dfb3b601bae49df714fac2a4c762cc6dbf9 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -99,6 +99,7 @@ ThreadState::ThreadState()
, m_gcForbiddenCount(0)
, m_persistentAllocated(0)
, m_persistentFreed(0)
+ , m_pageNavigationCount(0)
, m_vectorBackingHeapIndex(Vector1HeapIndex)
, m_currentHeapAges(0)
, m_isTerminating(false)
@@ -703,6 +704,16 @@ void ThreadState::schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio)
ASSERT(!isSweepingInProgress());
ASSERT(!sweepForbidden());
+ ++m_pageNavigationCount;
+ if (m_pageNavigationCount >= 5) {
+ // A frame retains a lot of memory in the V8 side. V8's GC cannot
+ // collect the memory until Oilpan's GC collects the frame. So we
+ // force a conservative GC if no Oilpan's GC has been observed in
+ // the past 5 frame navigations.
+ Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::ConservativeGC);
+ return;
+ }
+
if (shouldSchedulePageNavigationGC(estimatedRemovalRatio))
schedulePageNavigationGC();
}
@@ -1397,6 +1408,7 @@ void ThreadState::clearHeapAges()
memset(m_heapAges, 0, sizeof(size_t) * NumberOfHeaps);
memset(m_likelyToBePromptlyFreed.get(), 0, sizeof(int) * likelyToBePromptlyFreedArraySize);
m_currentHeapAges = 0;
+ m_pageNavigationCount = 0;
keishi 2015/09/19 06:12:15 nit: I'm not sure if this belongs here because it
haraken 2015/09/19 08:17:14 Moved this to preGC.
}
int ThreadState::heapIndexOfVectorHeapLeastRecentlyExpanded(int beginHeapIndex, int endHeapIndex)
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698