Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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.15',
'v8_embedder_string': '-node.16',

##### V8 defaults for Node.js #####

Expand Down
1 change: 1 addition & 0 deletions deps/v8/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Artem Kobzar <artem.kobzar@jetbrains.com>
Arthur Islamov <arthur@islamov.ai>
Asuka Shikina <shikina.asuka@gmail.com>
Aurèle Barrière <aurele.barriere@gmail.com>
Austin Burdine <austin@ghost.org>
Aviv Keller <me@aviv.sh>
Ayako Hayasaka <a.iwasaki0128@gmail.com>
Bala Avulapati <bavulapati@gmail.com>
Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/heap/gc-tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ class V8_EXPORT_PRIVATE GCTracer {
FRIEND_TEST(GCTracerTest, BackgroundMajorMCScope);
FRIEND_TEST(GCTracerTest, CyclePriorities);
FRIEND_TEST(GCTracerTest, EmbedderAllocationThroughput);
FRIEND_TEST(GCTracerTest, HighAllocationRateWithEmbedderAllocation);
FRIEND_TEST(GCTracerTest, MultithreadedBackgroundScope);
FRIEND_TEST(GCTracerTest, NewSpaceAllocationThroughput);
FRIEND_TEST(GCTracerTest, PerGenerationAllocationThroughput);
Expand All @@ -700,6 +701,7 @@ class V8_EXPORT_PRIVATE GCTracer {
FRIEND_TEST(GCTracerTest, IncrementalMarkingDetails);
FRIEND_TEST(GCTracerTest, IncrementalScope);
FRIEND_TEST(GCTracerTest, IncrementalMarkingSpeed);
FRIEND_TEST(GCTracerTest, LowAllocationRateWithZeroEmbedderAllocation);
FRIEND_TEST(GCTracerTest, MutatorUtilization);
FRIEND_TEST(GCTracerTest, RecordMarkCompactHistograms);
FRIEND_TEST(GCTracerTest, RecordScavengerHistograms);
Expand Down
2 changes: 0 additions & 2 deletions deps/v8/src/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3492,9 +3492,7 @@ namespace {

double ComputeMutatorUtilizationImpl(double mutator_speed,
std::optional<double> gc_speed) {
constexpr double kMinMutatorUtilization = 0.0;
constexpr double kConservativeGcSpeedInBytesPerMillisecond = 200000;
if (mutator_speed == 0) return kMinMutatorUtilization;
if (!gc_speed) gc_speed = kConservativeGcSpeedInBytesPerMillisecond;
// Derivation:
// mutator_utilization = mutator_time / (mutator_time + gc_time)
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/heap/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ class Heap final {
// null.
V8_INLINE bool CanSafepoint() const { return deserialization_complete(); }

bool HasLowAllocationRate();
V8_EXPORT_PRIVATE bool HasLowAllocationRate();
bool HasHighFragmentation();

void ActivateMemoryReducerIfNeeded();
Expand Down
39 changes: 39 additions & 0 deletions deps/v8/test/unittests/heap/gc-tracer-unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,45 @@ TEST_F(GCTracerTest, PerGenerationAllocationThroughput) {
tracer->ExternalAllocationThroughputInBytesPerMillisecond()));
}

TEST_F(GCTracerTest, LowAllocationRateWithZeroEmbedderAllocation) {
if (v8_flags.stress_incremental_marking) return;
Heap* heap = i_isolate()->heap();
GCTracer* tracer = heap->tracer();
tracer->ResetForTesting();
tracer->allocation_time_ = base::TimeTicks();

// Two samples 100 ms apart. Young and old generation allocate a little;
// the embedder (CppHeap) and external memory allocate nothing at all, as
// in an embedder that never uses cppgc (e.g. Node.js without node:vm).
tracer->SampleAllocation(base::TimeTicks::FromMsTicksForTesting(0), 0, 0, 0,
0);
tracer->SampleAllocation(base::TimeTicks::FromMsTicksForTesting(100), 100,
100, 0, 0);

EXPECT_DOUBLE_EQ(0.0,
tracer->EmbedderAllocationThroughputInBytesPerMillisecond());
EXPECT_TRUE(heap->HasLowAllocationRate());
}

TEST_F(GCTracerTest, HighAllocationRateWithEmbedderAllocation) {
if (v8_flags.stress_incremental_marking) return;
Heap* heap = i_isolate()->heap();
GCTracer* tracer = heap->tracer();
tracer->ResetForTesting();
tracer->allocation_time_ = base::TimeTicks();

// Same as above, but the embedder allocates heavily: 1 GB over 100 ms is
// ~10^7 B/ms, so the embedder term must still report a high allocation
// rate (mu = 200000 / (10^7 + 200000) < 0.993).
tracer->SampleAllocation(base::TimeTicks::FromMsTicksForTesting(0), 0, 0, 0,
0);
tracer->SampleAllocation(base::TimeTicks::FromMsTicksForTesting(100), 100,
100, size_t{1} << 30, 0);

EXPECT_GT(tracer->EmbedderAllocationThroughputInBytesPerMillisecond(), 0.0);
EXPECT_FALSE(heap->HasLowAllocationRate());
}

TEST_F(GCTracerTest, RegularScope) {
if (v8_flags.stress_incremental_marking) return;
GCTracer* tracer = i_isolate()->heap()->tracer();
Expand Down