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

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

Issue 1157933002: Oilpan: introduce eager finalization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove HeapIndexTrait + tidy up 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.cpp ('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 eefce3ea7d2444e3dda43b92cd739fc64e8c8d56..c93b6b6dddcd400cf99f863edfcf1181da8c5a2e 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -913,22 +913,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
+ poisonEagerHeaps(true);
#endif
#if ENABLE(OILPAN)
if (gcState() == EagerSweepScheduled) {
// Eager sweeping should happen only in testing.
setGCState(Sweeping);
+ eagerSweep();
+#if defined(ADDRESS_SANITIZER)
+ poisonHeapsForCompleteSweep();
haraken 2015/05/28 12:30:04 poisonEagerHeaps => poisonEagerHeap poisonHeapsFor
sof 2015/05/29 21:25:08 Done.
+#endif
completeSweep();
} else {
// The default behavior is lazy sweeping.
setGCState(Sweeping);
eagerSweep();
+#if defined(ADDRESS_SANITIZER)
+ poisonHeapsForCompleteSweep();
+#endif
scheduleIdleLazySweep();
}
#else
@@ -943,6 +946,28 @@ void ThreadState::preSweep()
#endif
}
+#if defined(ADDRESS_SANITIZER)
+void ThreadState::poisonHeapsForCompleteSweep()
+{
+ // TODO(Oilpan): enable the poisoning always.
+#if ENABLE(OILPAN)
+ // Unpoison the live objects remaining in the eager heaps..
+ poisonEagerHeaps(false);
+ // ..along with poisoning all unmarked objects in the other heaps.
+ for (int i = 1; i < NumberOfHeaps; i++)
+ m_heaps[i]->poisonUnmarkedObjects();
+#endif
+}
+
+void ThreadState::poisonEagerHeaps(bool poisonOrNot)
+{
+ // TODO(Oilpan): enable the poisoning always.
+#if ENABLE(OILPAN)
+ m_heaps[EagerSweepHeapIndex]->poisonHeap(poisonOrNot);
+#endif
+}
+#endif
+
void ThreadState::eagerSweep()
{
// Some objects need to be finalized promptly and cannot be handled
@@ -986,6 +1011,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();
« Source/platform/heap/Heap.cpp ('K') | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698