Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index 5f22565fb9268a21bb5e548c9a74c8ed77067d82..bdbeaeaa152515e7d54b7464f1ee722baad3e2a0 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -535,7 +535,7 @@ void MarkCompactCollector::StartSweeperThreads() { |
} |
-void MarkCompactCollector::WaitUntilSweepingCompleted() { |
+bool MarkCompactCollector::WaitUntilSweepingCompleted() { |
Michael Starzinger
2013/02/21 12:22:09
Why do you return a boolean here? IMHO this makes
Hannes Payer (out of office)
2013/02/21 12:52:31
Done.
|
if (sweeping_pending_) { |
for (int i = 0; i < FLAG_sweeper_threads; i++) { |
heap()->isolate()->sweeper_threads()[i]->WaitForSweeperThread(); |
@@ -543,8 +543,9 @@ void MarkCompactCollector::WaitUntilSweepingCompleted() { |
sweeping_pending_ = false; |
StealMemoryFromSweeperThreads(heap()->paged_space(OLD_DATA_SPACE)); |
StealMemoryFromSweeperThreads(heap()->paged_space(OLD_POINTER_SPACE)); |
- heap()->FreeQueuedChunks(); |
+ return true; |
} |
+ return false; |
} |
@@ -568,6 +569,13 @@ bool MarkCompactCollector::IsConcurrentSweepingInProgress() { |
} |
+void MarkCompactCollector::FinalizeSweeping() { |
+ ASSERT(sweeping_pending_ == false); |
+ ReleaseEvacuationCandidates(); |
+ heap()->FreeQueuedChunks(); |
+} |
+ |
+ |
void MarkCompactCollector::MarkInParallel() { |
for (int i = 0; i < FLAG_marking_threads; i++) { |
heap()->isolate()->marking_threads()[i]->StartMarking(); |
@@ -886,7 +894,9 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) { |
if (AreSweeperThreadsActivated() && FLAG_concurrent_sweeping) { |
// Instead of waiting we could also abort the sweeper threads here. |
- WaitUntilSweepingCompleted(); |
+ if (WaitUntilSweepingCompleted()) { |
+ FinalizeSweeping(); |
+ } |
} |
// Clear marking bits if incremental marking is aborted. |
@@ -3280,6 +3290,11 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() { |
slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_); |
ASSERT(migration_slots_buffer_ == NULL); |
+} |
+ |
+ |
+void MarkCompactCollector::ReleaseEvacuationCandidates() { |
+ int npages = evacuation_candidates_.length(); |
for (int i = 0; i < npages; i++) { |
Page* p = evacuation_candidates_[i]; |
if (!p->IsEvacuationCandidate()) continue; |
@@ -3877,6 +3892,10 @@ void MarkCompactCollector::SweepSpaces() { |
// Deallocate unmarked objects and clear marked bits for marked objects. |
heap_->lo_space()->FreeUnmarkedObjects(); |
+ |
+ if (!FLAG_concurrent_sweeping) { |
Michael Starzinger
2013/02/21 12:22:09
This is still not entirely correct, it _has_ to de
Hannes Payer (out of office)
2013/02/21 12:52:31
Done.
|
+ FinalizeSweeping(); |
+ } |
} |