diff --git a/common.gypi b/common.gypi index c55c84f5cca41e..404fd4615e2e8c 100644 --- a/common.gypi +++ b/common.gypi @@ -27,7 +27,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.4', + 'v8_embedder_string': '-node.7', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/src/heap/gc-tracer.cc b/deps/v8/src/heap/gc-tracer.cc index ddfcd07cc12378..e14fbb4862ebcd 100644 --- a/deps/v8/src/heap/gc-tracer.cc +++ b/deps/v8/src/heap/gc-tracer.cc @@ -490,6 +490,8 @@ void GCTracer::PrintNVP() const { "promotion_rate=%.1f%% " "semi_space_copy_rate=%.1f%% " "new_space_allocation_throughput=%.1f " + "unmapper_chunks=%d " + "unmapper_delayed_chunks=%d " "context_disposal_rate=%.1f\n", duration, spent_in_mutator, current_.TypeName(true), current_.reduce_memory, current_.scopes[Scope::HEAP_PROLOGUE], @@ -520,6 +522,8 @@ void GCTracer::PrintNVP() const { AverageSurvivalRatio(), heap_->promotion_rate_, heap_->semi_space_copied_rate_, NewSpaceAllocationThroughputInBytesPerMillisecond(), + heap_->memory_allocator()->unmapper()->NumberOfChunks(), + heap_->memory_allocator()->unmapper()->NumberOfDelayedChunks(), ContextDisposalRateInMilliseconds()); break; case Event::MINOR_MARK_COMPACTOR: @@ -654,6 +658,8 @@ void GCTracer::PrintNVP() const { "promotion_rate=%.1f%% " "semi_space_copy_rate=%.1f%% " "new_space_allocation_throughput=%.1f " + "unmapper_chunks=%d " + "unmapper_delayed_chunks=%d " "context_disposal_rate=%.1f " "compaction_speed=%.f\n", duration, spent_in_mutator, current_.TypeName(true), @@ -731,6 +737,8 @@ void GCTracer::PrintNVP() const { AverageSurvivalRatio(), heap_->promotion_rate_, heap_->semi_space_copied_rate_, NewSpaceAllocationThroughputInBytesPerMillisecond(), + heap_->memory_allocator()->unmapper()->NumberOfChunks(), + heap_->memory_allocator()->unmapper()->NumberOfDelayedChunks(), ContextDisposalRateInMilliseconds(), CompactionSpeedInBytesPerMillisecond()); break; diff --git a/deps/v8/src/heap/heap.cc b/deps/v8/src/heap/heap.cc index 0b5a90afb08b1c..b13ec784f56358 100644 --- a/deps/v8/src/heap/heap.cc +++ b/deps/v8/src/heap/heap.cc @@ -1885,6 +1885,12 @@ void Heap::Scavenge() { IncrementalMarking::PauseBlackAllocationScope pause_black_allocation( incremental_marking()); + if (mark_compact_collector()->sweeper().sweeping_in_progress() && + memory_allocator_->unmapper()->NumberOfDelayedChunks() > + static_cast(new_space_->MaximumCapacity() / Page::kPageSize)) { + mark_compact_collector()->EnsureSweepingCompleted(); + } + mark_compact_collector()->sweeper().EnsureNewSpaceCompleted(); SetGCState(SCAVENGE); diff --git a/deps/v8/src/heap/spaces.cc b/deps/v8/src/heap/spaces.cc index 66c63e58635b44..74fee75673c3dc 100644 --- a/deps/v8/src/heap/spaces.cc +++ b/deps/v8/src/heap/spaces.cc @@ -408,6 +408,15 @@ void MemoryAllocator::Unmapper::ReconsiderDelayedChunks() { } } +int MemoryAllocator::Unmapper::NumberOfChunks() { + base::LockGuard guard(&mutex_); + size_t result = 0; + for (int i = 0; i < kNumberOfChunkQueues; i++) { + result += chunks_[i].size(); + } + return static_cast(result); +} + bool MemoryAllocator::CanFreeMemoryChunk(MemoryChunk* chunk) { MarkCompactCollector* mc = isolate_->heap()->mark_compact_collector(); // We cannot free a memory chunk in new space while the sweeper is running diff --git a/deps/v8/src/heap/spaces.h b/deps/v8/src/heap/spaces.h index d5dc5b1115cccb..4f4de139e4507b 100644 --- a/deps/v8/src/heap/spaces.h +++ b/deps/v8/src/heap/spaces.h @@ -1199,6 +1199,13 @@ class V8_EXPORT_PRIVATE MemoryAllocator { bool has_delayed_chunks() { return delayed_regular_chunks_.size() > 0; } + int NumberOfDelayedChunks() { + base::LockGuard guard(&mutex_); + return static_cast(delayed_regular_chunks_.size()); + } + + int NumberOfChunks(); + private: static const int kReservedQueueingSlots = 64; static const int kMaxUnmapperTasks = 24;