[heap] Ensure progress in unmapping memory chunks.

If sweeping is not making progress and there are many young generation
GCs happening, then this can lead to accumulation of memory chunks in
the unmapper queue.

Bug: chromium:771966
Change-Id: Ief73ada0d17198a80b668850c6d2e7ea413113e7
Reviewed-on: https://chromium-review.googlesource.com/702479
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48312}
This commit is contained in:
Ulan Degenbaev 2017-10-05 15:11:37 +02:00 committed by Commit Bot
parent 87e1b8dfdb
commit 2c75616028
2 changed files with 11 additions and 0 deletions

View File

@ -1935,6 +1935,12 @@ void Heap::Scavenge() {
IncrementalMarking::PauseBlackAllocationScope pause_black_allocation( IncrementalMarking::PauseBlackAllocationScope pause_black_allocation(
incremental_marking()); incremental_marking());
if (mark_compact_collector()->sweeper().sweeping_in_progress() &&
memory_allocator_->unmapper()->NumberOfDelayedChunks() >
kMaxSemiSpaceSizeInKB / Page::kPageSize) {
mark_compact_collector()->EnsureSweepingCompleted();
}
mark_compact_collector()->sweeper().EnsureNewSpaceCompleted(); mark_compact_collector()->sweeper().EnsureNewSpaceCompleted();
SetGCState(SCAVENGE); SetGCState(SCAVENGE);

View File

@ -1196,6 +1196,11 @@ class V8_EXPORT_PRIVATE MemoryAllocator {
bool has_delayed_chunks() { return delayed_regular_chunks_.size() > 0; } bool has_delayed_chunks() { return delayed_regular_chunks_.size() > 0; }
int NumberOfDelayedChunks() {
base::LockGuard<base::Mutex> guard(&mutex_);
return static_cast<int>(delayed_regular_chunks_.size());
}
private: private:
static const int kReservedQueueingSlots = 64; static const int kReservedQueueingSlots = 64;
static const int kMaxUnmapperTasks = 24; static const int kMaxUnmapperTasks = 24;