Chromium Code Reviews| Index: src/heap/heap.cc |
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
| index accae68a1260ce53ba5fe2b83f996e5633b2d7ee..8dfcdc8fab3554c90449a604afb8decae507dd57 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), |
| @@ -5760,6 +5761,8 @@ void Heap::TearDown() { |
| memory_reducer_ = nullptr; |
| } |
| + WaitUntilUnmappingOfFreeChunksCompleted(); |
|
Hannes Payer (out of office)
2015/08/27 12:34:37
We should also wait when we tear down the heap.
|
| + |
| TearDownArrayBuffers(); |
| isolate_->global_handles()->TearDown(); |
| @@ -6524,7 +6527,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 +6539,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) { |
| + // 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 +6582,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_++; |
| } |