diff --git a/common.gypi b/common.gypi index c55c84f5cca41e..fe19499be21b5e 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.5', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/src/heap/heap.cc b/deps/v8/src/heap/heap.cc index 0b5a90afb08b1c..9f29717803a0ab 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() > + kMaxSemiSpaceSizeInKB / Page::kPageSize) { + mark_compact_collector()->EnsureSweepingCompleted(); + } + mark_compact_collector()->sweeper().EnsureNewSpaceCompleted(); SetGCState(SCAVENGE); diff --git a/deps/v8/src/heap/spaces.h b/deps/v8/src/heap/spaces.h index d5dc5b1115cccb..230a127809a697 100644 --- a/deps/v8/src/heap/spaces.h +++ b/deps/v8/src/heap/spaces.h @@ -1199,6 +1199,11 @@ 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()); + } + private: static const int kReservedQueueingSlots = 64; static const int kMaxUnmapperTasks = 24;