Index: src/heap/mark-compact.cc |
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
index 5c2c012f04f7d32386eb085405d1185a8e8e9df0..b6466b9066513fd6e4d0b2219dbd5b8f1a55079e 100644 |
--- a/src/heap/mark-compact.cc |
+++ b/src/heap/mark-compact.cc |
@@ -583,12 +583,12 @@ void MarkCompactCollector::EnsureSweepingCompleted() { |
} |
bool MarkCompactCollector::Sweeper::IsSweepingCompleted() { |
- if (!pending_sweeper_tasks_semaphore_.WaitFor( |
- base::TimeDelta::FromSeconds(0))) { |
- return false; |
+ while ((num_sweeping_tasks_ > 0) && |
+ pending_sweeper_tasks_semaphore_.WaitFor( |
+ base::TimeDelta::FromSeconds(0))) { |
+ num_sweeping_tasks_--; |
} |
- pending_sweeper_tasks_semaphore_.Signal(); |
- return true; |
+ return num_sweeping_tasks_ == 0; |
} |
void Marking::TransferMark(Heap* heap, Address old_start, Address new_start) { |