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

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

Issue 1159773004: Oilpan: Implement a GC to take a heap snapshot (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 90421079cecaaf7ecf0b5030bc839390d1bd024c..019fa3776fc88b06f2c06c9f5bdc9bbae1457b83 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -849,6 +849,13 @@ void ThreadState::makeConsistentForGC()
m_heaps[i]->makeConsistentForGC();
}
+void ThreadState::makeConsistentForMutator()
+{
+ ASSERT(isInGC());
+ for (int i = 0; i < NumberOfHeaps; ++i)
+ m_heaps[i]->makeConsistentForMutator();
+}
+
void ThreadState::preGC()
{
ASSERT(!isInGC());
@@ -881,9 +888,23 @@ void ThreadState::postGC(GCType gcType)
}
#endif
- setGCState(gcType == GCWithSweep ? EagerSweepScheduled : LazySweepScheduled);
for (int i = 0; i < NumberOfHeaps; i++)
m_heaps[i]->prepareForSweep();
+
+ if (gcType == GCWithSweep) {
+ setGCState(EagerSweepScheduled);
+ } else if (gcType == GCWithoutSweep) {
+ setGCState(LazySweepScheduled);
+ } else {
+ takeSnapshot();
+
+ // This unmarks all marked objects and marks all unmarked objects dead.
+ makeConsistentForMutator();
+
+ // Force setting NoGCScheduled to circumvent checkThread()
+ // in setGCState().
+ m_gcState = NoGCScheduled;
+ }
}
void ThreadState::preSweep()
@@ -1266,6 +1287,12 @@ void ThreadState::promptlyFreed(size_t gcInfoIndex)
m_likelyToBePromptlyFreed[entryIndex] += 3;
}
+void ThreadState::takeSnapshot()
+{
+ ASSERT(isInGC());
+ // TODO(ssid): Implement this.
+}
+
#if ENABLE(GC_PROFILING)
const GCInfo* ThreadState::findGCInfoFromAllThreads(Address address)
{
« 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