Commit ebda415e authored by hpayer's avatar hpayer Committed by Commit bot

Wait for concurrent unmapping tasks in GC prologue.

BUG=chromium:525372
LOG=n

Review URL: https://codereview.chromium.org/1320893002

Cr-Commit-Position: refs/heads/master@{#30411}
parent 8198610d
......@@ -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_unmapping_tasks_active_(0),
pending_unmapping_tasks_semaphore_(0),
gc_callbacks_depth_(0),
deserialization_complete_(false),
concurrent_sweeping_enabled_(false),
......@@ -5771,6 +5772,8 @@ void Heap::TearDown() {
memory_reducer_ = nullptr;
}
WaitUntilUnmappingOfFreeChunksCompleted();
TearDownArrayBuffers();
isolate_->global_handles()->TearDown();
......@@ -6532,7 +6535,7 @@ class Heap::UnmapFreeMemoryTask : public v8::Task {
// v8::Task overrides.
void Run() override {
heap_->FreeQueuedChunks(head_);
heap_->pending_unmap_job_semaphore_.Signal();
heap_->pending_unmapping_tasks_semaphore_.Signal();
}
Heap* heap_;
......@@ -6543,9 +6546,10 @@ 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();
while (concurrent_unmapping_tasks_active_ > 0) {
pending_unmapping_tasks_semaphore_.Wait();
concurrent_unmapping_tasks_active_--;
}
}
......@@ -6582,8 +6586,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_unmapping_tasks_semaphore_.Signal();
}
concurrent_unmapping_tasks_active_++;
}
......
......@@ -2389,7 +2389,9 @@ class Heap {
MemoryChunk* chunks_queued_for_free_;
base::Semaphore pending_unmap_job_semaphore_;
size_t concurrent_unmapping_tasks_active_;
base::Semaphore pending_unmapping_tasks_semaphore_;
base::Mutex relocation_mutex_;
......
......@@ -550,8 +550,6 @@ void MarkCompactCollector::EnsureSweepingCompleted() {
pending_sweeper_jobs_semaphore_.Wait();
}
heap()->WaitUntilUnmappingOfFreeChunksCompleted();
ParallelSweepSpacesComplete();
sweeping_in_progress_ = false;
RefillFreeList(heap()->paged_space(OLD_SPACE));
......@@ -812,6 +810,10 @@ void MarkCompactCollector::Prepare() {
EnsureSweepingCompleted();
}
// If concurrent unmapping tasks are still running, we should wait for
// them here.
heap()->WaitUntilUnmappingOfFreeChunksCompleted();
// Clear marking bits if incremental marking is aborted.
if (was_marked_incrementally_ && heap_->ShouldAbortIncrementalMarking()) {
heap()->incremental_marking()->Stop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment