Chromium Code Reviews| Index: third_party/WebKit/Source/platform/heap/Heap.h |
| diff --git a/third_party/WebKit/Source/platform/heap/Heap.h b/third_party/WebKit/Source/platform/heap/Heap.h |
| index 84753b2b9c76aff95e132ba5fdeac79979319f7d..195ba4391258ffac35dfaa5dfa9f6b5f888cf1fe 100644 |
| --- a/third_party/WebKit/Source/platform/heap/Heap.h |
| +++ b/third_party/WebKit/Source/platform/heap/Heap.h |
| @@ -32,6 +32,7 @@ |
| #define Heap_h |
| #include "platform/PlatformExport.h" |
| +#include "platform/heap/CallbackStack.h" |
| #include "platform/heap/GCInfo.h" |
| #include "platform/heap/HeapPage.h" |
| #include "platform/heap/PageMemory.h" |
| @@ -71,6 +72,28 @@ public: |
| } |
| }; |
| +class PLATFORM_EXPORT GCData { |
| +public: |
| + GCData(ThreadState*, BlinkGC::StackState, BlinkGC::GCType); |
| + |
| + bool parkAllThreads(BlinkGC::StackState, BlinkGC::GCType); |
| + |
| + ThreadState* threadState() const { return m_state; } |
| + Visitor* visitor() const { return m_visitor.get(); } |
| + CallbackStack* markingStack() const { return m_markingStack.get(); } |
| + CallbackStack* postMarkingCallbackStack() const { return m_postMarkingCallbackStack.get(); } |
| + CallbackStack* globalWeakCallbackStack() const { return m_globalWeakCallbackStack.get(); } |
| + CallbackStack* ephemeronStack() const { return m_ephemeronStack.get(); } |
| + |
| +private: |
| + ThreadState* m_state; |
| + OwnPtr<Visitor> m_visitor; |
| + OwnPtr<CallbackStack> m_markingStack; |
| + OwnPtr<CallbackStack> m_postMarkingCallbackStack; |
| + OwnPtr<CallbackStack> m_globalWeakCallbackStack; |
| + OwnPtr<CallbackStack> m_ephemeronStack; |
| +}; |
| + |
| class PLATFORM_EXPORT Heap { |
| public: |
| static void init(); |
| @@ -140,12 +163,12 @@ public: |
| } |
| // Push a trace callback on the marking stack. |
| - static void pushTraceCallback(void* containerObject, TraceCallback); |
| + static void pushTraceCallback(void* containerObject, TraceCallback, GCData*); |
|
haraken
2016/01/28 15:52:49
Nit: These push methods should be members of GCDat
keishi
2016/02/29 06:02:32
I moved the callback stack related methods to Visi
|
| // Push a trace callback on the post-marking callback stack. These |
| // callbacks are called after normal marking (including ephemeron |
| // iteration). |
| - static void pushPostMarkingCallback(void*, TraceCallback); |
| + static void pushPostMarkingCallback(void*, TraceCallback, GCData*); |
| // Add a weak pointer callback to the weak callback work list. General |
| // object pointer callbacks are added to a thread local weak callback work |
| @@ -160,7 +183,7 @@ public: |
| // pointer callbacks are added to a static callback work list and the weak |
| // callback is performed on the thread performing garbage collection. This |
| // is OK because cells are just cleared and no deallocation can happen. |
| - static void pushGlobalWeakCallback(void** cell, WeakCallback); |
| + static void pushGlobalWeakCallback(void** cell, WeakCallback, GCData*); |
| // Pop the top of a marking stack and call the callback with the visitor |
| // and the object. Returns false when there is nothing more to do. |
| @@ -177,9 +200,9 @@ public: |
| static bool popAndInvokeGlobalWeakCallback(Visitor*); |
| // Register an ephemeron table for fixed-point iteration. |
| - static void registerWeakTable(void* containerObject, EphemeronCallback, EphemeronCallback); |
| + static void registerWeakTable(void* containerObject, EphemeronCallback, EphemeronCallback, GCData*); |
| #if ENABLE(ASSERT) |
| - static bool weakTableRegistered(const void*); |
| + static bool weakTableRegistered(const void*, GCData*); |
| #endif |
| static inline size_t allocationSizeFromSize(size_t size) |
| @@ -218,17 +241,14 @@ public: |
| static size_t objectPayloadSizeForTesting(); |
| - static void flushHeapDoesNotContainCache(); |
| - |
| - static FreePagePool* freePagePool() { return s_freePagePool; } |
| - static OrphanedPagePool* orphanedPagePool() { return s_orphanedPagePool; } |
| - |
| - // This look-up uses the region search tree and a negative contains cache to |
| - // provide an efficient mapping from arbitrary addresses to the containing |
| - // heap-page if one exists. |
| - static BasePage* lookup(Address); |
| - static void addPageMemoryRegion(PageMemoryRegion*); |
| - static void removePageMemoryRegion(PageMemoryRegion*); |
| + static void increaseTotalAllocatedObjectSize(size_t delta) { atomicAdd(&s_totalAllocatedObjectSize, static_cast<long>(delta)); } |
| + static void decreaseTotalAllocatedObjectSize(size_t delta) { atomicSubtract(&s_totalAllocatedObjectSize, static_cast<long>(delta)); } |
| + static size_t totalAllocatedObjectSize() { return acquireLoad(&s_totalAllocatedObjectSize); } |
| + static void increaseTotalMarkedObjectSize(size_t delta) { atomicAdd(&s_totalMarkedObjectSize, static_cast<long>(delta)); } |
| + static size_t totalMarkedObjectSize() { return acquireLoad(&s_totalMarkedObjectSize); } |
| + static void increaseTotalAllocatedSpace(size_t delta) { atomicAdd(&s_totalMarkedObjectSize, static_cast<long>(delta)); } |
| + static void decreaseTotalAllocatedSpace(size_t delta) { atomicSubtract(&s_totalAllocatedSpace, static_cast<long>(delta)); } |
| + static size_t totalAllocatedSpace() { return acquireLoad(&s_totalAllocatedSpace); } |
| static const GCInfo* gcInfo(size_t gcInfoIndex) |
| { |
| @@ -240,33 +260,9 @@ public: |
| return info; |
| } |
| - static void setMarkedObjectSizeAtLastCompleteSweep(size_t size) { releaseStore(&s_markedObjectSizeAtLastCompleteSweep, size); } |
| - static size_t markedObjectSizeAtLastCompleteSweep() { return acquireLoad(&s_markedObjectSizeAtLastCompleteSweep); } |
| - static void increaseAllocatedObjectSize(size_t delta) { atomicAdd(&s_allocatedObjectSize, static_cast<long>(delta)); } |
| - static void decreaseAllocatedObjectSize(size_t delta) { atomicSubtract(&s_allocatedObjectSize, static_cast<long>(delta)); } |
| - static size_t allocatedObjectSize() { return acquireLoad(&s_allocatedObjectSize); } |
| - static void increaseMarkedObjectSize(size_t delta) { atomicAdd(&s_markedObjectSize, static_cast<long>(delta)); } |
| - static size_t markedObjectSize() { return acquireLoad(&s_markedObjectSize); } |
| - static void increaseAllocatedSpace(size_t delta) { atomicAdd(&s_allocatedSpace, static_cast<long>(delta)); } |
| - static void decreaseAllocatedSpace(size_t delta) { atomicSubtract(&s_allocatedSpace, static_cast<long>(delta)); } |
| - static size_t allocatedSpace() { return acquireLoad(&s_allocatedSpace); } |
| - static size_t objectSizeAtLastGC() { return acquireLoad(&s_objectSizeAtLastGC); } |
| - static void increaseWrapperCount(size_t delta) { atomicAdd(&s_wrapperCount, static_cast<long>(delta)); } |
| - static void decreaseWrapperCount(size_t delta) { atomicSubtract(&s_wrapperCount, static_cast<long>(delta)); } |
| - static size_t wrapperCount() { return acquireLoad(&s_wrapperCount); } |
| - static size_t wrapperCountAtLastGC() { return acquireLoad(&s_wrapperCountAtLastGC); } |
| - static void increaseCollectedWrapperCount(size_t delta) { atomicAdd(&s_collectedWrapperCount, static_cast<long>(delta)); } |
| - static size_t collectedWrapperCount() { return acquireLoad(&s_collectedWrapperCount); } |
| - static size_t partitionAllocSizeAtLastGC() { return acquireLoad(&s_partitionAllocSizeAtLastGC); } |
| - |
| - static double estimatedMarkingTime(); |
| static void reportMemoryUsageHistogram(); |
| static void reportMemoryUsageForTracing(); |
| -#if ENABLE(ASSERT) |
| - static uint16_t gcGeneration() { return s_gcGeneration; } |
| -#endif |
| - |
| private: |
| // Reset counters that track live and allocated-since-last-GC sizes. |
| static void resetHeapCounters(); |
| @@ -274,30 +270,16 @@ private: |
| static int heapIndexForObjectSize(size_t); |
| static bool isNormalHeapIndex(int); |
| - static CallbackStack* s_markingStack; |
| - static CallbackStack* s_postMarkingCallbackStack; |
| - static CallbackStack* s_globalWeakCallbackStack; |
| - static CallbackStack* s_ephemeronStack; |
| - static HeapDoesNotContainCache* s_heapDoesNotContainCache; |
| static bool s_shutdownCalled; |
| - static FreePagePool* s_freePagePool; |
| - static OrphanedPagePool* s_orphanedPagePool; |
| - static RegionTree* s_regionTree; |
| - static size_t s_allocatedSpace; |
| - static size_t s_allocatedObjectSize; |
| - static size_t s_objectSizeAtLastGC; |
| - static size_t s_markedObjectSize; |
| - static size_t s_markedObjectSizeAtLastCompleteSweep; |
| - static size_t s_wrapperCount; |
| - static size_t s_wrapperCountAtLastGC; |
| - static size_t s_collectedWrapperCount; |
| - static size_t s_partitionAllocSizeAtLastGC; |
| - static double s_estimatedMarkingTimePerByte; |
| -#if ENABLE(ASSERT) |
| - static uint16_t s_gcGeneration; |
| -#endif |
| + static bool s_doShutdownDone; |
| + |
| + // Stats for the entire Oilpan heap. |
| + static size_t s_totalAllocatedSpace; |
| + static size_t s_totalAllocatedObjectSize; |
| + static size_t s_totalMarkedObjectSize; |
| friend class ThreadState; |
| + friend class MultiThreadGCGroup; |
| }; |
| template<typename T> |