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

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

Issue 747363005: Oilpan: Introduce a state transition model for Oilpan GC states (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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/HeapTest.cpp ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/ThreadState.h
diff --git a/Source/platform/heap/ThreadState.h b/Source/platform/heap/ThreadState.h
index 54f9fe25d845a66b994acc0f0595393330ebdc79..2f60c9006df0cd14e991fc55c4836ace93a214fa 100644
--- a/Source/platform/heap/ThreadState.h
+++ b/Source/platform/heap/ThreadState.h
@@ -320,6 +320,16 @@ public:
ForcedGC
};
+ // See setGCState() for possible state transitions.
+ enum GCState {
+ NoGCScheduled,
+ GCScheduled,
+ StoppingOtherThreads,
+ GCRunning,
+ SweepScheduled,
+ Sweeping,
+ };
+
class NoSweepScope {
public:
explicit NoSweepScope(ThreadState* state) : m_state(state)
@@ -399,11 +409,6 @@ public:
return true;
}
- // If gcRequested returns true when a thread returns to its event
- // loop the thread will initiate a garbage collection.
- bool gcRequested();
- void setGCRequested();
- void clearGCRequested();
void didV8GC();
// shouldGC and shouldForceConservativeGC implement the heuristics
@@ -416,6 +421,13 @@ public:
bool shouldGC();
bool shouldForceConservativeGC();
+ void requestGC() { setGCState(GCScheduled); }
+ void setGCState(GCState);
+ GCState gcState() const;
+
+ void preGC();
+ void postGC();
+
// Was the last GC forced for testing? This is set when garbage collection
// is forced for testing and there are pointers on the stack. It remains
// set until a garbage collection is triggered with no pointers on the stack.
@@ -425,9 +437,6 @@ public:
void setForcePreciseGCForTesting(bool);
bool forcePreciseGCForTesting();
- bool sweepRequested();
- void setSweepRequested();
- void clearSweepRequested();
void performPendingSweep();
// Support for disallowing allocation. Mainly used for sanity
@@ -440,31 +449,11 @@ public:
// made consistent for sweeping.
void makeConsistentForSweeping();
- // Is the thread corresponding to this thread state currently
- // performing GC?
- bool isInGC() const { return m_inGC; }
-
- // FIXME: This will be removed soon.
- void enterGC()
- {
- ASSERT(!m_inGC);
- m_inGC = true;
- }
-
- // FIXME: This will be removed soon.
- void leaveGC()
- {
- ASSERT(m_inGC);
- m_inGC = false;
- }
-
- // Is the thread corresponding to this thread state currently
- // sweeping?
+ // Is this thread currently sweeping?
bool isSweepInProgress() const { return m_sweepInProgress; }
void prepareRegionTree();
void flushHeapDoesNotContainCacheIfNeeded();
- void prepareForGC();
// Safepoint related functionality.
//
@@ -750,13 +739,10 @@ private:
Vector<Address> m_safePointStackCopy;
bool m_atSafePoint;
Vector<Interruptor*> m_interruptors;
- bool m_gcRequested;
bool m_didV8GCAfterLastGC;
bool m_forcePreciseGCForTesting;
- volatile int m_sweepRequested;
bool m_sweepInProgress;
size_t m_noAllocationCount;
- bool m_inGC;
BaseHeap* m_heaps[NumberOfHeaps];
Vector<OwnPtr<CleanupTask> > m_cleanupTasks;
@@ -764,6 +750,7 @@ private:
bool m_shouldFlushHeapDoesNotContainCache;
double m_collectionRate;
+ GCState m_gcState;
CallbackStack* m_weakCallbackStack;
HashMap<void*, bool (*)(void*, Visitor&)> m_preFinalizers;
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698