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

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: review iteration + rebase 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
« no previous file with comments | « 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..c75b6e0a3c0e9484e21dfa377c484200faa58376 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,29 @@ 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());
+
+ // Mirroring the completeSweep() condition; see its comment.
+ if (sweepForbidden())
+ return;
+
+ ThreadState::SweepForbiddenScope scope(this);
+ {
+ if (isMainThread())
+ ScriptForbiddenScope::enter();
+
+ m_heaps[EagerSweepHeapIndex]->completeSweep();
+
+ if (isMainThread())
+ ScriptForbiddenScope::exit();
+ }
+}
+
void ThreadState::completeSweep()
{
// If we are not in a sweeping phase, there is nothing to do here.
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698