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

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

Issue 1085023002: patch from issue 1063083002 at patchset 20001 (http://crrev.com/1063083002#ps20001) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months 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/core/dom/Text.cpp ('k') | Source/platform/heap/Heap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.h
diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h
index 5bd5addd0d4027a38ae0463c9cf356c07053c2a5..9894c769c7a152ed0ff1e18702b60db3ce9f97fd 100644
--- a/Source/platform/heap/Heap.h
+++ b/Source/platform/heap/Heap.h
@@ -1021,26 +1021,11 @@ public:
static size_t allocatedSpace() { return acquireLoad(&s_allocatedSpace); }
static size_t estimatedLiveObjectSize() { return acquireLoad(&s_estimatedLiveObjectSize); }
static void setEstimatedLiveObjectSize(size_t size) { releaseStore(&s_estimatedLiveObjectSize, size); }
+ static size_t externalObjectSizeAtLastGC() { return acquireLoad(&s_externalObjectSizeAtLastGC); }
static double estimatedMarkingTime();
static void reportMemoryUsageHistogram();
- // On object allocation, register the object's externally allocated memory.
- static void increaseExternallyAllocatedBytes(size_t);
- static size_t externallyAllocatedBytes() { return acquireLoad(&s_externallyAllocatedBytes); }
-
- // On object tracing, register the object's 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();
- static void clearUrgentGC() { releaseStore(&s_requestedUrgentGC, 0); }
- static bool isUrgentGCRequested() { return acquireLoad(&s_requestedUrgentGC); }
-
private:
// A RegionTree is a simple binary search tree of PageMemoryRegions sorted
// by base addresses.
@@ -1079,9 +1064,7 @@ private:
static size_t s_allocatedObjectSize;
static size_t s_markedObjectSize;
static size_t s_estimatedLiveObjectSize;
- static size_t s_externallyAllocatedBytes;
- static size_t s_externallyAllocatedBytesAlive;
- static unsigned s_requestedUrgentGC;
+ static size_t s_externalObjectSizeAtLastGC;
static double s_estimatedMarkingTimePerByte;
friend class ThreadState;
@@ -1478,28 +1461,6 @@ Address Heap::reallocate(void* previous, size_t size)
return address;
}
-inline void Heap::increaseExternallyAllocatedBytes(size_t delta)
-{
- // Flag GC urgency on a 50% increase in external allocation
- // since the last GC, but not for less than 100M.
- //
- // FIXME: consider other, 'better' policies (e.g., have the count of
- // heap objects with external allocations be taken into
- // account, ...) The overall goal here is to trigger a
- // GC such that it considerably lessens memory pressure
- // for a renderer process, when absolutely needed.
- size_t externalBytesAllocatedSinceLastGC = atomicAdd(&s_externallyAllocatedBytes, static_cast<long>(delta));
- if (LIKELY(externalBytesAllocatedSinceLastGC < 100 * 1024 * 1024))
- return;
-
- if (UNLIKELY(isUrgentGCRequested()))
- return;
-
- size_t externalBytesAliveAtLastGC = externallyAllocatedBytesAlive();
- if (UNLIKELY(externalBytesAllocatedSinceLastGC > externalBytesAliveAtLastGC / 2))
- Heap::requestUrgentGC();
-}
-
template<bool needsTracing, WTF::WeakHandlingFlag weakHandlingFlag, WTF::ShouldWeakPointersBeMarkedStrongly strongify, typename T, typename Traits> struct CollectionBackingTraceTrait;
template<typename T, typename Traits = WTF::VectorTraits<T>> class HeapVectorBacking;
template<typename Table> class HeapHashTableBacking {
« no previous file with comments | « Source/core/dom/Text.cpp ('k') | Source/platform/heap/Heap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698