| Index: Source/platform/heap/Heap.h
|
| diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h
|
| index 1ddbf13997cb481c55d4e248f51df8a825ba7559..f7ffee114025653b66da6e5372c307f713f39fe9 100644
|
| --- a/Source/platform/heap/Heap.h
|
| +++ b/Source/platform/heap/Heap.h
|
| @@ -37,6 +37,7 @@
|
| #include "platform/heap/Visitor.h"
|
| #include "public/platform/WebThread.h"
|
| #include "wtf/Assertions.h"
|
| +#include "wtf/Atomics.h"
|
| #include "wtf/HashCountedSet.h"
|
| #include "wtf/LinkedHashSet.h"
|
| #include "wtf/ListHashSet.h"
|
| @@ -116,7 +117,6 @@ enum CallbackInvocationMode {
|
| };
|
|
|
| class CallbackStack;
|
| -class HeapStats;
|
| class PageMemory;
|
| template<ThreadAffinity affinity> class ThreadLocalPersistents;
|
| template<typename T, typename RootsAccessor = ThreadLocalPersistents<ThreadingTrait<T>::Affinity > > class Persistent;
|
| @@ -263,7 +263,7 @@ public:
|
|
|
| bool isMarked();
|
| void unmark();
|
| - void getStatsForTesting(HeapStats&);
|
| + size_t objectPayloadSizeForTesting();
|
| void mark(Visitor*);
|
| void finalize();
|
| void setDeadMark();
|
| @@ -537,9 +537,9 @@ public:
|
|
|
| Address end() { return payload() + payloadSize(); }
|
|
|
| - void getStatsForTesting(HeapStats&);
|
| + size_t objectPayloadSizeForTesting();
|
| void clearLiveAndMarkDead();
|
| - void sweep(HeapStats*, ThreadHeap<Header>*);
|
| + void sweep(ThreadHeap<Header>*);
|
| void clearObjectStartBitMap();
|
| void finalize(Header*);
|
| virtual void checkAndMarkPointer(Visitor*, Address) override;
|
| @@ -706,7 +706,7 @@ public:
|
|
|
| // Sweep this part of the Blink heap. This finalizes dead objects
|
| // and builds freelists for all the unused memory.
|
| - virtual void sweep(HeapStats*) = 0;
|
| + virtual void sweep() = 0;
|
| virtual void postSweepProcessing() = 0;
|
|
|
| virtual void clearFreeLists() = 0;
|
| @@ -716,7 +716,7 @@ public:
|
| #if ENABLE(ASSERT)
|
| virtual bool isConsistentForSweeping() = 0;
|
| #endif
|
| - virtual void getStatsForTesting(HeapStats&) = 0;
|
| + virtual size_t objectPayloadSizeForTesting() = 0;
|
|
|
| virtual void updateRemainingAllocationSize() = 0;
|
|
|
| @@ -776,7 +776,7 @@ public:
|
| virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override;
|
| #endif
|
|
|
| - virtual void sweep(HeapStats*) override;
|
| + virtual void sweep() override;
|
| virtual void postSweepProcessing() override;
|
|
|
| virtual void clearFreeLists() override;
|
| @@ -786,12 +786,11 @@ public:
|
| #if ENABLE(ASSERT)
|
| virtual bool isConsistentForSweeping() override;
|
| #endif
|
| - virtual void getStatsForTesting(HeapStats&) override;
|
| + virtual size_t objectPayloadSizeForTesting() override;
|
|
|
| virtual void updateRemainingAllocationSize() override;
|
|
|
| ThreadState* threadState() { return m_threadState; }
|
| - HeapStats& stats() { return m_threadState->stats(); }
|
|
|
| void addToFreeList(Address address, size_t size)
|
| {
|
| @@ -845,8 +844,8 @@ private:
|
| bool pagesAllocatedDuringSweepingContains(Address);
|
| #endif
|
|
|
| - void sweepNormalPages(HeapStats*);
|
| - void sweepLargePages(HeapStats*);
|
| + void sweepNormalPages();
|
| + void sweepLargePages();
|
| bool coalesce(size_t);
|
|
|
| Address m_currentAllocationPoint;
|
| @@ -967,7 +966,7 @@ public:
|
| static String createBacktraceString();
|
| #endif
|
|
|
| - static void getStatsForTesting(HeapStats*);
|
| + static size_t objectPayloadSizeForTesting();
|
|
|
| static void getHeapSpaceSize(uint64_t*, uint64_t*);
|
|
|
| @@ -993,6 +992,15 @@ public:
|
| static void addPageMemoryRegion(PageMemoryRegion*);
|
| static void removePageMemoryRegion(PageMemoryRegion*);
|
|
|
| + 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 s_allocatedObjectSize; }
|
| + static void increaseLiveObjectSize(size_t delta) { atomicAdd(&s_liveObjectSize, static_cast<long>(delta)); }
|
| + static size_t liveObjectSize() { return s_liveObjectSize; }
|
| + 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 s_allocatedSpace; }
|
| +
|
| private:
|
| // A RegionTree is a simple binary search tree of PageMemoryRegions sorted
|
| // by base addresses.
|
| @@ -1013,6 +1021,9 @@ private:
|
| RegionTree* m_right;
|
| };
|
|
|
| + static void resetAllocatedObjectSize() { ASSERT(ThreadState::isAnyThreadInGC()); s_allocatedObjectSize = 0; }
|
| + static void resetLiveObjectSize() { ASSERT(ThreadState::isAnyThreadInGC()); s_liveObjectSize = 0; }
|
| +
|
| static Visitor* s_markingVisitor;
|
| static Vector<OwnPtr<WebThread>>* s_markingThreads;
|
| static CallbackStack* s_markingStack;
|
| @@ -1025,6 +1036,9 @@ private:
|
| 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_liveObjectSize;
|
| friend class ThreadState;
|
| };
|
|
|
|
|