Index: Source/platform/heap/Heap.h |
diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h |
index e3289815642856b4b9a2cba5d92f03d2e2b0a163..b4530e9724fcfed364a356fcd5f5c6257d553e1d 100644 |
--- a/Source/platform/heap/Heap.h |
+++ b/Source/platform/heap/Heap.h |
@@ -1009,8 +1009,25 @@ public: |
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 double estimatedMarkingTime(); |
+ // On object allocation, register its externally allocated memory. |
+ static void increaseExternallyAllocatedBytes(size_t); |
+ static size_t externallyAllocatedBytes() { return acquireLoad(&s_externallyAllocatedBytes); } |
+ |
+ // On object tracing, register its externally allocated memory (as still live.) |
+ static void increaseExternallyAllocatedBytesAlive(size_t delta) |
+ { |
+ ASSERT(ThreadState::current()->isInGC()); |
+ s_externallyAllocatedBytesAlive += delta; |
+ } |
+ static size_t externallyAllocatedBytesAlive() { return s_externallyAllocatedBytesAlive; } |
+ |
+ static void requestUrgentGC() { releaseStore(&s_requestedUrgentGC, 1); } |
+ static void clearUrgentGC() { releaseStore(&s_requestedUrgentGC, 0); } |
+ static bool isGCUrgentlyRequested() { return acquireLoad(&s_requestedUrgentGC); } |
+ |
private: |
// A RegionTree is a simple binary search tree of PageMemoryRegions sorted |
// by base addresses. |
@@ -1031,8 +1048,8 @@ private: |
RegionTree* m_right; |
}; |
- static void resetAllocatedObjectSize() { ASSERT(ThreadState::current()->isInGC()); s_allocatedObjectSize = 0; } |
- static void resetMarkedObjectSize() { ASSERT(ThreadState::current()->isInGC()); s_markedObjectSize = 0; } |
+ // Reset counters that track live and allocated-since-last-GC sizes. |
+ static void resetHeapCounters(); |
static Visitor* s_markingVisitor; |
static CallbackStack* s_markingStack; |
@@ -1048,6 +1065,10 @@ private: |
static size_t s_allocatedSpace; |
static size_t s_allocatedObjectSize; |
static size_t s_markedObjectSize; |
+ static size_t s_externallyAllocatedBytes; |
+ static size_t s_externallyAllocatedBytesAlive; |
+ static unsigned s_requestedUrgentGC; |
+ |
friend class ThreadState; |
}; |