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

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

Issue 1138663002: Oilpan: support eager finalization/sweeping. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase + introduce OILPAN_EAGERLY_SWEEP() Created 5 years, 7 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
« Source/platform/heap/Heap.h ('K') | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/ThreadState.cpp
diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
index 699866a4516830374b32646ac8351c86a8c97e33..b9213bd5321fe46ef6f308ec4d52ec93387a05f6 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -912,6 +912,7 @@ void ThreadState::preSweep()
} else {
// The default behavior is lazy sweeping.
setGCState(Sweeping);
+ eagerSweep();
scheduleIdleLazySweep();
}
#else
@@ -926,6 +927,31 @@ void ThreadState::preSweep()
#endif
}
+void ThreadState::eagerSweep()
+{
+ // Some objects need to be finalized promptly and cannot be handled
+ // by lazy sweeping. Keep those in a designated heap and sweep it
+ // eagerly.
+ ASSERT(isSweepingInProgress());
+ ASSERT(!sweepForbidden());
haraken 2015/05/19 23:23:37 I think this should be: if (sweepForbidden())
sof 2015/05/20 09:43:01 Done + xref'ed the comment.
+
+ ThreadState::SweepForbiddenScope scope(this);
+ {
+ if (isMainThread())
+ ScriptForbiddenScope::enter();
+
+ TRACE_EVENT0("blink_gc", "ThreadState::eagerSweep");
+ double timeStamp = WTF::currentTimeMS();
haraken 2015/05/19 23:23:37 Remove this (see below).
sof 2015/05/20 09:43:01 Removed.
+
+ m_heaps[EagerSweepHeapIndex]->completeSweep();
+
+ Platform::current()->histogramCustomCounts("BlinkGC.EagerSweep", WTF::currentTimeMS() - timeStamp, 0, 10 * 1000, 50);
haraken 2015/05/19 23:23:37 This UMA doesn't exist (and wouldn't be worth addi
+
+ if (isMainThread())
+ ScriptForbiddenScope::exit();
+ }
+}
+
void ThreadState::completeSweep()
{
// If we are not in a sweeping phase, there is nothing to do here.
« Source/platform/heap/Heap.h ('K') | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698