[heap] Annotate reason for finishing sweeping [v8/v8 : main]

0 views
Skip to first unread message

Dominik Inführ (Gerrit)

unread,
Nov 3, 2025, 9:47:12 AM (4 days ago) Nov 3
to Michael Lippautz, V8 LUCI CQ, Hannes Payer, devtools-...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Michael Lippautz

Dominik Inführ added 5 comments

Patchset-level comments
File-level comment, Patchset 6 (Latest):
Dominik Inführ . resolved

PTAL

File src/heap/heap.h
Line 337, Patchset 5: void AtLeast(size_t new_min_old_gen_limit, size_t new_min_global_limit) {
Dominik Inführ . unresolved

This method and the next one are new. I am adding a test for them as well. But we don't use them yet.

File src/heap/heap.cc
Line 2680, Patchset 4: UpdateAllocationLimits(LimitBounds::AtMostCurrentLimits(this),
Dominik Inführ . unresolved

Drive-by: Use different caller to make it obvious whether UpdateAllocationLimits was called from major or minor GC.

Line 7806, Patchset 4 (Parent): TRACE_GC_EPOCH_WITH_FLOW(tracer(), GCTracer::Scope::MC_COMPLETE_SWEEPING,
Dominik Inführ . unresolved

This event already exists within the sweeper. That's why I remove it here and instead add ENSURE_SWEEPING_COMPLETED at the beginning of the method.

Line 7883, Patchset 4: !using_initial_limit()) {
Dominik Inführ . unresolved

In a subsequent CL we can then disable calling UpdateAllocationLimits() based on CompleteSweepingReason.

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Ia0436984e4d1c51934eeb6855621ea2c7d18cf11
Gerrit-Change-Number: 7105759
Gerrit-PatchSet: 6
Gerrit-Owner: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Mon, 03 Nov 2025 14:47:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Michael Lippautz (Gerrit)

unread,
Nov 4, 2025, 8:12:34 AM (3 days ago) Nov 4
to Dominik Inführ, V8 LUCI CQ, Hannes Payer, devtools-...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Dominik Inführ

Michael Lippautz voted and added 6 comments

Votes added by Michael Lippautz

Code-Review+1

6 comments

File src/heap/heap.h
Line 226, Patchset 7 (Latest): enum class CompleteSweepingReason {
Michael Lippautz . unresolved

nit: Some enums are easier to use when not being nested inside `Heap`. We already have a bunch of them and maybe this one should also go outside. (Judge yourself)

Line 337, Patchset 5: void AtLeast(size_t new_min_old_gen_limit, size_t new_min_global_limit) {
Dominik Inführ . resolved

This method and the next one are new. I am adding a test for them as well. But we don't use them yet.

Michael Lippautz

Acknowledged

File src/heap/heap.cc
Line 2680, Patchset 4: UpdateAllocationLimits(LimitBounds::AtMostCurrentLimits(this),
Dominik Inführ . unresolved

Drive-by: Use different caller to make it obvious whether UpdateAllocationLimits was called from major or minor GC.

Michael Lippautz

Shouldn't you add a string above then as well? So either adjust both or none?

Line 7806, Patchset 4 (Parent): TRACE_GC_EPOCH_WITH_FLOW(tracer(), GCTracer::Scope::MC_COMPLETE_SWEEPING,
Dominik Inführ . resolved

This event already exists within the sweeper. That's why I remove it here and instead add ENSURE_SWEEPING_COMPLETED at the beginning of the method.

Michael Lippautz

Acknowledged

Line 7807, Patchset 7 (Latest): if (v8_flags.trace_gc_verbose) {
Michael Lippautz . unresolved

[[unlikely]]

Line 7883, Patchset 4: !using_initial_limit()) {
Dominik Inführ . resolved

In a subsequent CL we can then disable calling UpdateAllocationLimits() based on CompleteSweepingReason.

Michael Lippautz

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Dominik Inführ
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Ia0436984e4d1c51934eeb6855621ea2c7d18cf11
Gerrit-Change-Number: 7105759
Gerrit-PatchSet: 7
Gerrit-Owner: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Dominik Inführ <dinf...@chromium.org>
Gerrit-Comment-Date: Tue, 04 Nov 2025 13:12:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Dominik Inführ <dinf...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Dominik Inführ (Gerrit)

unread,
Nov 4, 2025, 8:30:12 AM (3 days ago) Nov 4
to Michael Lippautz, V8 LUCI CQ, Hannes Payer, devtools-...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Michael Lippautz

Dominik Inführ added 3 comments

File src/heap/heap.h
Line 226, Patchset 7: enum class CompleteSweepingReason {
Michael Lippautz . resolved

nit: Some enums are easier to use when not being nested inside `Heap`. We already have a bunch of them and maybe this one should also go outside. (Judge yourself)

Dominik Inführ

Yes absolutely. I like it.

File src/heap/heap.cc
Line 2680, Patchset 4: UpdateAllocationLimits(LimitBounds::AtMostCurrentLimits(this),
Dominik Inführ . unresolved

Drive-by: Use different caller to make it obvious whether UpdateAllocationLimits was called from major or minor GC.

Michael Lippautz

Shouldn't you add a string above then as well? So either adjust both or none?

Dominik Inführ

So far both call sites used the default value for this method ("RecomputeLimits" - the default values uses __builtin_FUNCTION() or so). It was just a bit confusing to me that both minor and major GC used the same reason - so renaming just one is enough for me to distinguish them. But I might be missing something here.

Line 7807, Patchset 7: if (v8_flags.trace_gc_verbose) {
Michael Lippautz . resolved

[[unlikely]]

Dominik Inführ

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Ia0436984e4d1c51934eeb6855621ea2c7d18cf11
Gerrit-Change-Number: 7105759
Gerrit-PatchSet: 8
Gerrit-Owner: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Tue, 04 Nov 2025 13:30:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
Comment-In-Reply-To: Dominik Inführ <dinf...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Dominik Inführ (Gerrit)

unread,
Nov 4, 2025, 8:31:15 AM (3 days ago) Nov 4
to Michael Lippautz, V8 LUCI CQ, Hannes Payer, devtools-...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Michael Lippautz

Dominik Inführ added 1 comment

Patchset-level comments
File-level comment, Patchset 8 (Latest):
Dominik Inführ . resolved

Thanks for the review!

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Ia0436984e4d1c51934eeb6855621ea2c7d18cf11
Gerrit-Change-Number: 7105759
Gerrit-PatchSet: 8
Gerrit-Owner: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Tue, 04 Nov 2025 13:31:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Michael Lippautz (Gerrit)

unread,
Nov 4, 2025, 8:32:54 AM (3 days ago) Nov 4
to Dominik Inführ, V8 LUCI CQ, Hannes Payer, devtools-...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Dominik Inführ

Michael Lippautz voted and added 1 comment

Votes added by Michael Lippautz

Code-Review+1

1 comment

File src/heap/heap.cc
Line 2680, Patchset 4: UpdateAllocationLimits(LimitBounds::AtMostCurrentLimits(this),
Dominik Inführ . unresolved

Drive-by: Use different caller to make it obvious whether UpdateAllocationLimits was called from major or minor GC.

Michael Lippautz

Shouldn't you add a string above then as well? So either adjust both or none?

Dominik Inführ

So far both call sites used the default value for this method ("RecomputeLimits" - the default values uses __builtin_FUNCTION() or so). It was just a bit confusing to me that both minor and major GC used the same reason - so renaming just one is enough for me to distinguish them. But I might be missing something here.

Michael Lippautz

You can distinguish but it's not consistent in the terms of strings :)

Open in Gerrit

Related details

Attention is currently required from:
  • Dominik Inführ
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: Ia0436984e4d1c51934eeb6855621ea2c7d18cf11
Gerrit-Change-Number: 7105759
Gerrit-PatchSet: 8
Gerrit-Owner: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Dominik Inführ <dinf...@chromium.org>
Gerrit-Comment-Date: Tue, 04 Nov 2025 13:32:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Dominik Inführ (Gerrit)

unread,
Nov 4, 2025, 8:36:18 AM (3 days ago) Nov 4
to Michael Lippautz, V8 LUCI CQ, Hannes Payer, devtools-...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com

Dominik Inführ added 1 comment

File src/heap/heap.cc
Line 2680, Patchset 4: UpdateAllocationLimits(LimitBounds::AtMostCurrentLimits(this),
Dominik Inführ . resolved

Drive-by: Use different caller to make it obvious whether UpdateAllocationLimits was called from major or minor GC.

Michael Lippautz

Shouldn't you add a string above then as well? So either adjust both or none?

Dominik Inführ

So far both call sites used the default value for this method ("RecomputeLimits" - the default values uses __builtin_FUNCTION() or so). It was just a bit confusing to me that both minor and major GC used the same reason - so renaming just one is enough for me to distinguish them. But I might be missing something here.

Michael Lippautz

You can distinguish but it's not consistent in the terms of strings :)

Dominik Inführ

Ah right, good point. Updated it.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: v8/v8
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia0436984e4d1c51934eeb6855621ea2c7d18cf11
    Gerrit-Change-Number: 7105759
    Gerrit-PatchSet: 9
    Gerrit-Owner: Dominik Inführ <dinf...@chromium.org>
    Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
    Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
    Gerrit-CC: Hannes Payer <hpa...@chromium.org>
    Gerrit-Comment-Date: Tue, 04 Nov 2025 13:36:13 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    open
    diffy

    Dominik Inführ (Gerrit)

    unread,
    Nov 4, 2025, 8:36:27 AM (3 days ago) Nov 4
    to Michael Lippautz, V8 LUCI CQ, Hannes Payer, devtools-...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com

    Dominik Inführ voted Commit-Queue+2

    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: v8/v8
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia0436984e4d1c51934eeb6855621ea2c7d18cf11
    Gerrit-Change-Number: 7105759
    Gerrit-PatchSet: 9
    Gerrit-Owner: Dominik Inführ <dinf...@chromium.org>
    Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
    Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
    Gerrit-CC: Hannes Payer <hpa...@chromium.org>
    Gerrit-Comment-Date: Tue, 04 Nov 2025 13:36:22 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    V8 LUCI CQ (Gerrit)

    unread,
    Nov 4, 2025, 9:21:49 AM (3 days ago) Nov 4
    to Dominik Inführ, Michael Lippautz, Hannes Payer, devtools-...@chromium.org, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com

    V8 LUCI CQ submitted the change with unreviewed changes

    Unreviewed changes

    8 is the latest approved patch-set.
    The change was submitted with unreviewed changes in the following files:

    ```
    The name of the file: src/heap/heap.cc
    Insertions: 2, Deletions: 1.

    @@ -2665,7 +2665,8 @@

    void Heap::RecomputeLimits(GarbageCollector collector) {
    if (collector == GarbageCollector::MARK_COMPACTOR) {
    - const LimitsComputationResult new_limits = UpdateAllocationLimits({});
    + const LimitsComputationResult new_limits =
    + UpdateAllocationLimits({}, "RecomputeLimitsAfterMajorGC");

    if (v8_flags.memory_balancer) {
    // Now recompute the new allocation limit.
    ```

    Change information

    Commit message:
    [heap] Annotate reason for finishing sweeping

    This CL adds a new enum CompleteSweepingReason with all reasons for
    invoking EnsureSweepingCompleted(). It is also added as an additional
    argument to that method.

    The CL does not change any GC behavior yet. This will be done in a
    follow-up CL.
    Bug: 456384548
    Change-Id: Ia0436984e4d1c51934eeb6855621ea2c7d18cf11
    Commit-Queue: Dominik Inführ <dinf...@chromium.org>
    Reviewed-by: Michael Lippautz <mlip...@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#103499}
    Files:
    • M src/execution/isolate.h
    • M src/heap/gc-tracer-inl.h
    • M src/heap/gc-tracer.h
    • M src/heap/heap-verifier.cc
    • M src/heap/heap.cc
    • M src/heap/heap.h
    • M src/heap/paged-spaces.cc
    • M src/heap/read-only-heap.cc
    • M src/init/heap-symbols.h
    • M src/profiler/heap-snapshot-generator.cc
    • M test/cctest/heap/heap-utils.cc
    • M test/cctest/heap/test-compaction.cc
    • M test/cctest/heap/test-heap.cc
    • M test/cctest/heap/test-mark-compact.cc
    • M test/cctest/test-shared-strings.cc
    • M test/unittests/heap/conservative-stack-visitor-unittest.cc
    • M test/unittests/heap/cppgc-js/unified-heap-unittest.cc
    • M test/unittests/heap/heap-unittest.cc
    • M test/unittests/heap/heap-utils.cc
    • M test/unittests/heap/heap-utils.h
    Change size: L
    Delta: 20 files changed, 332 insertions(+), 139 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Michael Lippautz
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: v8/v8
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia0436984e4d1c51934eeb6855621ea2c7d18cf11
    Gerrit-Change-Number: 7105759
    Gerrit-PatchSet: 10
    Gerrit-Owner: Dominik Inführ <dinf...@chromium.org>
    Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
    Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
    Gerrit-CC: Hannes Payer <hpa...@chromium.org>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages