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

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

Issue 1157933002: Oilpan: introduce eager finalization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Parameterize Heap::poisonHeap() over ObjectsToPoison 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 9ef1f18dee738814d719af0bcbaa2ae7138ff9bc..e4c8669990f7e6c3652fdec1903c184ca9ddc586 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -919,22 +919,25 @@ void ThreadState::preSweep()
}
#if defined(ADDRESS_SANITIZER)
-// TODO(Oilpan): enable the poisoning always.
-#if ENABLE(OILPAN)
- for (int i = 0; i < NumberOfHeaps; i++)
- m_heaps[i]->poisonUnmarkedObjects();
-#endif
+ poisonEagerHeap(SetPoison);
#endif
#if ENABLE_LAZY_SWEEPING
if (gcState() == EagerSweepScheduled) {
// Eager sweeping should happen only in testing.
setGCState(Sweeping);
+ eagerSweep();
+#if defined(ADDRESS_SANITIZER)
+ poisonAllHeaps();
+#endif
completeSweep();
} else {
// The default behavior is lazy sweeping.
setGCState(Sweeping);
eagerSweep();
+#if defined(ADDRESS_SANITIZER)
+ poisonAllHeaps();
+#endif
scheduleIdleLazySweep();
}
#else
@@ -947,6 +950,28 @@ void ThreadState::preSweep()
#endif
}
+#if defined(ADDRESS_SANITIZER)
+void ThreadState::poisonAllHeaps()
+{
+ // TODO(Oilpan): enable the poisoning always.
+#if ENABLE(OILPAN)
+ // Unpoison the live objects remaining in the eager heaps..
+ poisonEagerHeap(ClearPoison);
+ // ..along with poisoning all unmarked objects in the other heaps.
+ for (int i = 1; i < NumberOfHeaps; i++)
+ m_heaps[i]->poisonHeap(UnmarkedOnly, SetPoison);
+#endif
+}
+
+void ThreadState::poisonEagerHeap(Poisoning poisoning)
+{
+ // TODO(Oilpan): enable the poisoning always.
+#if ENABLE(OILPAN)
+ m_heaps[EagerSweepHeapIndex]->poisonHeap(MarkedAndUnmarked, poisoning);
+#endif
+}
+#endif
+
void ThreadState::eagerSweep()
{
// Some objects need to be finalized promptly and cannot be handled
@@ -990,6 +1015,7 @@ void ThreadState::completeSweep()
TRACE_EVENT0("blink_gc", "ThreadState::completeSweep");
double timeStamp = WTF::currentTimeMS();
+ static_assert(EagerSweepHeapIndex == 0, "Eagerly swept heaps must be processed first.");
for (int i = 0; i < NumberOfHeaps; i++)
m_heaps[i]->completeSweep();
« 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