Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index ef1e755d8c3f9a0004420152ec4ce7415444b62b..77fd6810e6a4da5a112db481a47e86da10023562 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -587,6 +587,7 @@ void MarkCompactCollector::WaitUntilSweepingCompleted() { |
for (int i = 0; i < isolate()->num_sweeper_threads(); i++) { |
isolate()->sweeper_threads()[i]->WaitForSweeperThread(); |
} |
+ ParallelSweepSpacesComplete(); |
sweeping_pending_ = false; |
RefillFreeLists(heap()->paged_space(OLD_DATA_SPACE)); |
RefillFreeLists(heap()->paged_space(OLD_POINTER_SPACE)); |
@@ -3911,7 +3912,11 @@ intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space, |
(mode == MarkCompactCollector::SWEEP_SEQUENTIALLY && |
free_list == NULL)); |
- p->MarkSweptConservatively(); |
+ // When parallel sweeping is active, the page will be marked after |
+ // sweeping by the main thread. |
+ if (mode != MarkCompactCollector::SWEEP_IN_PARALLEL) { |
+ p->MarkSweptConservatively(); |
+ } |
intptr_t freed_bytes = 0; |
size_t size = 0; |
@@ -4023,7 +4028,7 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { |
while (it.has_next()) { |
Page* p = it.next(); |
- ASSERT(p->parallel_sweeping() == 0); |
+ ASSERT(p->parallel_sweeping() == MemoryChunk::PARALLEL_SWEEPING_DONE); |
ASSERT(!p->IsEvacuationCandidate()); |
// Clear sweeping flags indicating that marking bits are still intact. |
@@ -4096,7 +4101,7 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) { |
PrintF("Sweeping 0x%" V8PRIxPTR " conservatively in parallel.\n", |
reinterpret_cast<intptr_t>(p)); |
} |
- p->set_parallel_sweeping(1); |
+ p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_PENDING); |
space->IncreaseUnsweptFreeBytes(p); |
} |
break; |
@@ -4188,6 +4193,24 @@ void MarkCompactCollector::SweepSpaces() { |
} |
+void MarkCompactCollector::ParallelSweepSpaceComplete(PagedSpace* space) { |
+ PageIterator it(space); |
+ while (it.has_next()) { |
+ Page* p = it.next(); |
+ if (p->parallel_sweeping() == MemoryChunk::PARALLEL_SWEEPING_IN_PROGRESS) { |
+ p->set_parallel_sweeping(MemoryChunk::PARALLEL_SWEEPING_DONE); |
+ p->MarkSweptConservatively(); |
+ } |
+ } |
+} |
+ |
+ |
+void MarkCompactCollector::ParallelSweepSpacesComplete() { |
+ ParallelSweepSpaceComplete(heap()->old_pointer_space()); |
+ ParallelSweepSpaceComplete(heap()->old_data_space()); |
+} |
+ |
+ |
void MarkCompactCollector::EnableCodeFlushing(bool enable) { |
#ifdef ENABLE_DEBUGGER_SUPPORT |
if (isolate()->debug()->IsLoaded() || |