Skip to content

Commit 55a4d66

Browse files
committed
deps: cherry-pick 2c75616 from upstream V8
Original commit message: [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} Refs: v8/v8@2c75616 Refs: nodejs/help#917 (comment) Refs: https://bugs.chromium.org/p/chromium/issues/detail?id=771966 PR-URL: #16490 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 22882d4 commit 55a4d66

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# Reset this number to 0 on major V8 upgrades.
2929
# Increment by one for each non-official patch applied to deps/v8.
30-
'v8_embedder_string': '-node.4',
30+
'v8_embedder_string': '-node.5',
3131

3232
# Enable disassembler for `--print-code` v8 options
3333
'v8_enable_disassembler': 1,

deps/v8/src/heap/heap.cc

+6
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,12 @@ void Heap::Scavenge() {
18851885
IncrementalMarking::PauseBlackAllocationScope pause_black_allocation(
18861886
incremental_marking());
18871887

1888+
if (mark_compact_collector()->sweeper().sweeping_in_progress() &&
1889+
memory_allocator_->unmapper()->NumberOfDelayedChunks() >
1890+
kMaxSemiSpaceSizeInKB / Page::kPageSize) {
1891+
mark_compact_collector()->EnsureSweepingCompleted();
1892+
}
1893+
18881894
mark_compact_collector()->sweeper().EnsureNewSpaceCompleted();
18891895

18901896
SetGCState(SCAVENGE);

deps/v8/src/heap/spaces.h

+5
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,11 @@ class V8_EXPORT_PRIVATE MemoryAllocator {
11991199

12001200
bool has_delayed_chunks() { return delayed_regular_chunks_.size() > 0; }
12011201

1202+
int NumberOfDelayedChunks() {
1203+
base::LockGuard<base::Mutex> guard(&mutex_);
1204+
return static_cast<int>(delayed_regular_chunks_.size());
1205+
}
1206+
12021207
private:
12031208
static const int kReservedQueueingSlots = 64;
12041209
static const int kMaxUnmapperTasks = 24;

0 commit comments

Comments
 (0)