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

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

Issue 1115993003: Try reducing and balance GC callback stack sizes. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: initialize stacks also before doing thread-terminating GCs 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/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 c3c3eaddbfea5bb8fecfd098a1bce0840bbdaae0..c963e14bcebbdec15fffaf486e4d5323c29e2b57 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -1962,18 +1962,10 @@ void Heap::flushHeapDoesNotContainCache()
void Heap::init()
{
ThreadState::init();
- s_markingStack = new CallbackStack();
- s_postMarkingCallbackStack = new CallbackStack();
- s_weakCallbackStack = new CallbackStack();
- s_ephemeronStack = new CallbackStack();
- s_heapDoesNotContainCache = new HeapDoesNotContainCache();
s_markingVisitor = new MarkingVisitor<Visitor::GlobalMarking>();
+ s_heapDoesNotContainCache = new HeapDoesNotContainCache();
s_freePagePool = new FreePagePool();
s_orphanedPagePool = new OrphanedPagePool();
- s_allocatedObjectSize = 0;
- s_allocatedSpace = 0;
- s_markedObjectSize = 0;
- s_estimatedMarkingTimePerByte = 0.0;
GCInfoTable::init();
}
@@ -2259,6 +2251,7 @@ void Heap::collectGarbage(ThreadState::StackState stackState, ThreadState::GCTyp
ThreadState::NoAllocationScope noAllocationScope(state);
preGC();
+ Heap::ensureCallbackStacks();
StackFrameDepth::configureStackLimit();
ASSERT(StackFrameDepth::isSafeToRecurse());
@@ -2320,6 +2313,7 @@ void Heap::collectGarbageForTerminatingThread(ThreadState* state)
ThreadState::NoAllocationScope noAllocationScope(state);
state->preGC();
+ Heap::ensureCallbackStacks();
StackFrameDepth::configureStackLimit();
ASSERT(StackFrameDepth::isSafeToRecurse());
@@ -2674,11 +2668,22 @@ void Heap::resetHeapCounters()
s_externalObjectSizeAtLastGC = WTF::Partitions::totalSizeOfCommittedPages();
}
+void Heap::ensureCallbackStacks()
+{
+ if (s_markingStack)
+ return;
+
+ s_markingStack = new CallbackStack(CallbackStack::MarkingStackBlockSize);
+ s_postMarkingCallbackStack = new CallbackStack(CallbackStack::PostMarkingStackBlockSize);
+ s_weakCallbackStack = new CallbackStack(CallbackStack::WeakCallbackStackBlockSize);
+ s_ephemeronStack = new CallbackStack(CallbackStack::EphemeronCallbackStackBlockSize);
+}
+
Visitor* Heap::s_markingVisitor;
-CallbackStack* Heap::s_markingStack;
-CallbackStack* Heap::s_postMarkingCallbackStack;
-CallbackStack* Heap::s_weakCallbackStack;
-CallbackStack* Heap::s_ephemeronStack;
+CallbackStack* Heap::s_markingStack = nullptr;
+CallbackStack* Heap::s_postMarkingCallbackStack = nullptr;
+CallbackStack* Heap::s_weakCallbackStack = nullptr;
+CallbackStack* Heap::s_ephemeronStack = nullptr;
HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache;
bool Heap::s_shutdownCalled = false;
bool Heap::s_lastGCWasConservative = false;
« 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