Chromium Code Reviews| Index: Source/platform/heap/ThreadState.cpp |
| diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp |
| index eefce3ea7d2444e3dda43b92cd739fc64e8c8d56..b478a51002e467856f2553c6408948ab67046969 100644 |
| --- a/Source/platform/heap/ThreadState.cpp |
| +++ b/Source/platform/heap/ThreadState.cpp |
| @@ -838,19 +838,19 @@ void ThreadState::flushHeapDoesNotContainCacheIfNeeded() |
| } |
| } |
| -void ThreadState::makeConsistentForSweeping() |
| +void ThreadState::makeConsistentForSweeping(GCType gcType) |
| { |
| ASSERT(isInGC()); |
| TRACE_EVENT0("blink_gc", "ThreadState::makeConsistentForSweeping"); |
| for (int i = 0; i < NumberOfHeaps; ++i) |
| - m_heaps[i]->makeConsistentForSweeping(); |
| + m_heaps[i]->makeConsistentForSweeping(gcType); |
| } |
| -void ThreadState::preGC() |
| +void ThreadState::preGC(GCType gcType) |
| { |
| ASSERT(!isInGC()); |
| setGCState(GCRunning); |
| - makeConsistentForSweeping(); |
| + makeConsistentForSweeping(gcType); |
| prepareRegionTree(); |
| flushHeapDoesNotContainCacheIfNeeded(); |
| clearHeapAges(); |
| @@ -878,9 +878,21 @@ 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(); |
|
ssid
2015/05/27 12:43:47
Sorry, I just realized. This takeSnapshot() should
haraken
2015/05/27 13:48:10
prepareForSweep() needs to be called, because the
|
| + // This unmarks all marked objects and marks all unmarked objects dead. |
| + makeConsistentForSweeping(gcType); |
| + // Force setting NoGCScheduled to circumvent checkThread() |
| + // in setGCState(). |
| + m_gcState = NoGCScheduled; |
| + } |
| } |
| void ThreadState::preSweep() |
| @@ -1265,6 +1277,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) |
| { |