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

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

Issue 723513002: Oilpan: Refactor the way we calculate heap statistics (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 a7621cce8d357b9beb2e382802b9f7e45078c506..7e8ae44b945e37f18093aa110090c1a4432dd681 100644
--- a/Source/platform/heap/ThreadState.h
+++ b/Source/platform/heap/ThreadState.h
@@ -295,62 +295,6 @@ struct HeapTypeTrait : public HeapIndexTrait<General1Heap> { };
FOR_EACH_TYPED_HEAP(DEFINE_TYPED_HEAP_TRAIT)
#undef DEFINE_TYPED_HEAP_TRAIT
-// A HeapStats structure keeps track of the amount of memory allocated
-// for a Blink heap and how much of that memory is used for actual
-// Blink objects. These stats are used in the heuristics to determine
-// when to perform garbage collections.
-class HeapStats {
-public:
- HeapStats() : m_totalObjectSpace(0), m_totalAllocatedSpace(0) { }
-
- size_t totalObjectSpace() const { return m_totalObjectSpace; }
- size_t totalAllocatedSpace() const { return m_totalAllocatedSpace; }
-
- void add(HeapStats* other)
- {
- m_totalObjectSpace += other->m_totalObjectSpace;
- m_totalAllocatedSpace += other->m_totalAllocatedSpace;
- }
-
- void inline increaseObjectSpace(size_t newObjectSpace)
- {
- m_totalObjectSpace += newObjectSpace;
- }
-
- void inline decreaseObjectSpace(size_t deadObjectSpace)
- {
- m_totalObjectSpace -= deadObjectSpace;
- }
-
- void inline increaseAllocatedSpace(size_t newAllocatedSpace)
- {
- m_totalAllocatedSpace += newAllocatedSpace;
- }
-
- void inline decreaseAllocatedSpace(size_t deadAllocatedSpace)
- {
- m_totalAllocatedSpace -= deadAllocatedSpace;
- }
-
- void clear()
- {
- m_totalObjectSpace = 0;
- m_totalAllocatedSpace = 0;
- }
-
- bool operator==(const HeapStats& other)
- {
- return m_totalAllocatedSpace == other.m_totalAllocatedSpace
- && m_totalObjectSpace == other.m_totalObjectSpace;
- }
-
-private:
- size_t m_totalObjectSpace; // Actually contains objects that may be live, not including headers.
- size_t m_totalAllocatedSpace; // Allocated from the OS.
-
- friend class HeapTester;
-};
-
class PLATFORM_EXPORT ThreadState {
WTF_MAKE_NONCOPYABLE(ThreadState);
public:
@@ -448,6 +392,12 @@ 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();
+
// shouldGC and shouldForceConservativeGC implement the heuristics
// that are used to determine when to collect garbage. If
// shouldForceConservativeGC returns true, we force the garbage
@@ -457,14 +407,6 @@ public:
// collect garbage at this point.
bool shouldGC();
bool shouldForceConservativeGC();
- bool increasedEnoughToGC(size_t, size_t);
- bool increasedEnoughToForceConservativeGC(size_t, size_t);
-
- // 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();
// 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
@@ -713,9 +655,7 @@ public:
void pushWeakObjectPointerCallback(void*, WeakPointerCallback);
bool popAndInvokeWeakPointerCallback(Visitor*);
- void getStats(HeapStats&);
- void getStatsForTesting(HeapStats&);
- HeapStats& stats() { return m_stats; }
+ size_t objectPayloadSizeForTesting();
void setupHeapsForTermination();
@@ -790,8 +730,6 @@ private:
void cleanup();
void cleanupPages();
- void setLowCollectionRate(bool value) { m_lowCollectionRate = value; }
-
void performPendingSweepInParallel();
void waitUntilSweepersDone();
void unregisterPreFinalizerInternal(void*);
@@ -831,8 +769,6 @@ private:
size_t m_noAllocationCount;
bool m_inGC;
BaseHeap* m_heaps[NumberOfHeaps];
- HeapStats m_stats;
- HeapStats m_statsAfterLastGC;
Vector<OwnPtr<CleanupTask> > m_cleanupTasks;
bool m_isTerminating;
« 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