Chromium Code Reviews| Index: Source/platform/heap/ThreadState.h |
| diff --git a/Source/platform/heap/ThreadState.h b/Source/platform/heap/ThreadState.h |
| index 074fafe02efb7642ba032d45da9defd8faf63b15..ed1a0cf3806d26071bdb0adc101d7befc27d875c 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, |
|
tkent
2014/11/26 02:27:07
What's 'GC' here? Does this contains both of marki
|
| + 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(); |
|
tkent
2014/11/26 02:27:07
nit: I'd like to keep setGCRequested() as an alias
haraken
2014/11/26 05:27:01
Done.
|
| - void clearGCRequested(); |
| void didV8GC(); |
| // shouldGC and shouldForceConservativeGC implement the heuristics |
| @@ -416,6 +421,9 @@ public: |
| bool shouldGC(); |
| bool shouldForceConservativeGC(); |
| + void setGCState(GCState); |
| + GCState gcState() const; |
| + |
| // 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 +433,6 @@ public: |
| void setForcePreciseGCForTesting(bool); |
| bool forcePreciseGCForTesting(); |
| - bool sweepRequested(); |
| - void setSweepRequested(); |
| - void clearSweepRequested(); |
| void performPendingSweep(); |
| // Support for disallowing allocation. Mainly used for sanity |
| @@ -443,35 +448,13 @@ public: |
| bool isConsistentForSweeping(); |
| #endif |
| - // Is the thread corresponding to this thread state currently |
| - // performing GC? |
| - bool isInGC() const { return m_inGC; } |
| - |
| - // Is any of the threads registered with the blink garbage collection |
| - // infrastructure currently performing GC? |
| - static bool isAnyThreadInGC() { return s_inGC; } |
| - |
| - void enterGC() |
| - { |
| - ASSERT(!m_inGC); |
| - ASSERT(!s_inGC); |
| - m_inGC = true; |
| - s_inGC = true; |
| - } |
| - |
| - void leaveGC() |
| - { |
| - m_inGC = false; |
| - s_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(); |
| + void preGC(); |
| + void postGC(); |
| // Safepoint related functionality. |
| // |
| @@ -741,10 +724,6 @@ private: |
| static uintptr_t s_mainThreadUnderestimatedStackSize; |
| static SafePointBarrier* s_safePointBarrier; |
| - // This variable is flipped to true after all threads are stoped |
| - // and outermost GC has started. |
| - static bool s_inGC; |
| - |
| // We can't create a static member of type ThreadState here |
| // because it will introduce global constructor and destructor. |
| // We would like to manage lifetime of the ThreadState attached |
| @@ -763,13 +742,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; |
| @@ -777,6 +753,7 @@ private: |
| bool m_shouldFlushHeapDoesNotContainCache; |
| bool m_lowCollectionRate; |
| + GCState m_gcState; |
| CallbackStack* m_weakCallbackStack; |
| HashMap<void*, bool (*)(void*, Visitor&)> m_preFinalizers; |