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