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

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

Issue 1369783002: Reinstate memory pressure Oilpan GC check post V8 major GCs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: introduce conditional helper for mem-pressure GCs 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 | « third_party/WebKit/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: third_party/WebKit/Source/platform/heap/ThreadState.cpp
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
index 4a1efe48e8904b9f5bcf581155bcf3d28980ee82..9222e8bb75494167a15e14433158469e96e62842 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -670,6 +670,18 @@ bool ThreadState::shouldForceConservativeGC()
return judgeGCThreshold(32 * 1024 * 1024, 5.0);
}
+bool ThreadState::forceMemoryPressureGCIfNeeded()
+{
+ if (!shouldForceMemoryPressureGC())
+ return false;
+ completeSweep();
+ if (!shouldForceMemoryPressureGC())
+ return false;
+
+ Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::ConservativeGC);
+ return true;
+}
+
void ThreadState::scheduleV8FollowupGCIfNeeded(V8GCType gcType)
{
ASSERT(checkThread());
@@ -678,6 +690,11 @@ void ThreadState::scheduleV8FollowupGCIfNeeded(V8GCType gcType)
if (isGCForbidden())
return;
+ // If V8 has acted on a memory pressure signal and performed a major GC,
+ // follow up, if needed.
+ if (gcType == V8MajorGC && forceMemoryPressureGCIfNeeded())
+ return;
+
if (isSweepingInProgress())
return;
ASSERT(!sweepForbidden());
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698