Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index accae68a1260ce53ba5fe2b83f996e5633b2d7ee..96d0a00c863db54de117a6652c135fea46e7cd6f 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -137,7 +137,8 @@ Heap::Heap() |
current_gc_callback_flags_(GCCallbackFlags::kNoGCCallbackFlags), |
external_string_table_(this), |
chunks_queued_for_free_(NULL), |
- pending_unmap_job_semaphore_(0), |
+ concurrent_unmaping_tasks_active_(0), |
+ pending_unmap_tasks_semaphore_(0), |
gc_callbacks_depth_(0), |
deserialization_complete_(false), |
concurrent_sweeping_enabled_(false), |
@@ -6524,7 +6525,7 @@ class Heap::UnmapFreeMemoryTask : public v8::Task { |
// v8::Task overrides. |
void Run() override { |
heap_->FreeQueuedChunks(head_); |
- heap_->pending_unmap_job_semaphore_.Signal(); |
+ heap_->pending_unmap_tasks_semaphore_.Signal(); |
} |
Heap* heap_; |
@@ -6536,8 +6537,13 @@ class Heap::UnmapFreeMemoryTask : public v8::Task { |
void Heap::WaitUntilUnmappingOfFreeChunksCompleted() { |
// We start an unmap job after sweeping and after compaction. |
- pending_unmap_job_semaphore_.Wait(); |
- pending_unmap_job_semaphore_.Wait(); |
+ if (concurrent_unmaping_tasks_active_ > 0) { |
Michael Lippautz
2015/08/27 11:37:41
We could make this more general, so that we can st
Hannes Payer (out of office)
2015/08/27 12:34:37
The intention was to assert if we are waiting for
|
+ // There should be two concurrent unmapping tasks running. |
+ DCHECK(concurrent_unmaping_tasks_active_ == 2); |
+ pending_unmap_tasks_semaphore_.Wait(); |
+ pending_unmap_tasks_semaphore_.Wait(); |
+ concurrent_unmaping_tasks_active_ = 0; |
+ } |
} |
@@ -6574,8 +6580,9 @@ void Heap::FreeQueuedChunks() { |
} else { |
// If we do not have anything to unmap, we just signal the semaphore |
// that we are done. |
- pending_unmap_job_semaphore_.Signal(); |
+ pending_unmap_tasks_semaphore_.Signal(); |
} |
+ concurrent_unmaping_tasks_active_++; |
} |