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

Unified Diff: Source/heap/ThreadState.cpp

Issue 220203005: Oilpan: introduce sticky forcedForTesting flag to ensure that a precise (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix js-test.js use in test. Created 6 years, 9 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/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/heap/ThreadState.cpp
diff --git a/Source/heap/ThreadState.cpp b/Source/heap/ThreadState.cpp
index 6d8aa23ca52db6429c9b5444dc7082004fb6879d..f762436b065435d65b3a4ab55bf80cf4d4156486 100644
--- a/Source/heap/ThreadState.cpp
+++ b/Source/heap/ThreadState.cpp
@@ -235,6 +235,7 @@ ThreadState::ThreadState()
, m_atSafePoint(false)
, m_interruptors()
, m_gcRequested(false)
+ , m_forcePreciseGCForTesting(false)
, m_sweepRequested(0)
, m_sweepInProgress(false)
, m_noAllocationCount(0)
@@ -497,6 +498,26 @@ void ThreadState::clearGCRequested()
m_gcRequested = false;
}
+void ThreadState::performPendingGC(StackState stackState)
+{
+ if (stackState == NoHeapPointersOnStack && (gcRequested() || forcePreciseGCForTesting())) {
+ setForcedForTesting(false);
+ Heap::collectGarbage(NoHeapPointersOnStack);
+ }
+}
+
+void ThreadState::setForcedForTesting(bool value)
+{
+ checkThread();
+ m_forcePreciseGCForTesting = value;
+}
+
+bool ThreadState::forcePreciseGCForTesting()
+{
+ checkThread();
+ return m_forcePreciseGCForTesting;
+}
+
bool ThreadState::isConsistentForGC()
{
for (int i = 0; i < NumberOfHeaps; i++) {
@@ -589,8 +610,7 @@ void ThreadState::resumeThreads()
void ThreadState::safePoint(StackState stackState)
{
checkThread();
- if (stackState == NoHeapPointersOnStack && gcRequested())
- Heap::collectGarbage(NoHeapPointersOnStack);
+ performPendingGC(stackState);
m_stackState = stackState;
s_safePointBarrier->checkAndPark(this);
m_stackState = HeapPointersOnStack;
@@ -628,8 +648,7 @@ void ThreadState::enterSafePoint(StackState stackState, void* scopeMarker)
scopeMarker = adjustScopeMarkerForAdressSanitizer(scopeMarker);
#endif
ASSERT(stackState == NoHeapPointersOnStack || scopeMarker);
- if (stackState == NoHeapPointersOnStack && gcRequested())
- Heap::collectGarbage(NoHeapPointersOnStack);
+ performPendingGC(stackState);
checkThread();
ASSERT(!m_atSafePoint);
m_atSafePoint = true;
« no previous file with comments | « Source/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698