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

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

Issue 875503003: Allow Oilpan heap objects account for their external allocations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: more minor stuff Created 5 years, 10 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/platform/heap/Heap.h ('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/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index e21fdf68dc1d73c0c4ccd7e293f04aee7d6b3ce2..3edbf6206b5b97b0e67515ccb9091c33a404a035 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -2475,8 +2475,7 @@ void Heap::collectGarbage(ThreadState::StackState stackState, ThreadState::GCTyp
s_markingVisitor->configureEagerTraceLimit();
ASSERT(s_markingVisitor->canTraceEagerly());
- Heap::resetMarkedObjectSize();
- Heap::resetAllocatedObjectSize();
+ Heap::resetHeapCounters();
// 1. Trace persistent roots.
ThreadState::visitPersistentRoots(s_markingVisitor);
@@ -2840,6 +2839,32 @@ void Heap::RegionTree::remove(PageMemoryRegion* region, RegionTree** context)
delete current;
}
+void Heap::resetHeapCounters()
+{
+ ASSERT(ThreadState::current()->isInGC());
+
+ s_allocatedObjectSize = 0;
+ s_markedObjectSize = 0;
+
+ // Similarly, reset the amount of externally allocated memory.
+ s_externallyAllocatedBytes = 0;
+ s_externallyAllocatedBytesAlive = 0;
+
+ s_requestedUrgentGC = false;
+}
+
+void Heap::requestUrgentGC()
+{
+ // The urgent-gc flag will be considered the next time an out-of-line
+ // allocation is made. Bump allocations from the current block will
+ // go ahead until it can no longer service an allocation request.
+ //
+ // FIXME: if that delays urgently needed GCs for too long, consider
+ // flushing out per-heap "allocation points" to trigger the GC
+ // right away.
+ releaseStore(&s_requestedUrgentGC, 1);
+}
+
Visitor* Heap::s_markingVisitor;
CallbackStack* Heap::s_markingStack;
CallbackStack* Heap::s_postMarkingCallbackStack;
@@ -2855,4 +2880,8 @@ size_t Heap::s_allocatedObjectSize = 0;
size_t Heap::s_allocatedSpace = 0;
size_t Heap::s_markedObjectSize = 0;
+size_t Heap::s_externallyAllocatedBytes = 0;
+size_t Heap::s_externallyAllocatedBytesAlive = 0;
+unsigned Heap::s_requestedUrgentGC = false;
+
} // namespace blink
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698