[baseline] Optimize ToBooleanForBaselineJump for static roots [v8/v8 : main]

0 views
Skip to first unread message

Leszek Swirski (Gerrit)

unread,
Feb 3, 2026, 7:18:37 AM (21 hours ago) Feb 3
to Victor Gomes, V8 LUCI CQ, v8-re...@googlegroups.com
Attention needed from Victor Gomes

Leszek Swirski voted and added 1 comment

Votes added by Leszek Swirski

Auto-Submit+1

1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Leszek Swirski . resolved

PTAL, followup to the other one to avoid redundant checks.

Open in Gerrit

Related details

Attention is currently required from:
  • Victor Gomes
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • 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: I22d745e2d50223aaf433f143344870a01da72e0c
Gerrit-Change-Number: 7539376
Gerrit-PatchSet: 1
Gerrit-Owner: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Victor Gomes <victo...@chromium.org>
Gerrit-Attention: Victor Gomes <victo...@chromium.org>
Gerrit-Comment-Date: Tue, 03 Feb 2026 12:18:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Victor Gomes (Gerrit)

unread,
Feb 3, 2026, 7:38:43 AM (21 hours ago) Feb 3
to Leszek Swirski, V8 LUCI CQ, v8-re...@googlegroups.com
Attention needed from Leszek Swirski

Victor Gomes voted and added 2 comments

Votes added by Victor Gomes

Code-Review+1

2 comments

Patchset-level comments
Victor Gomes . resolved

LGTM + suggestion.

File src/codegen/code-stub-assembler.cc
Line 1714, Patchset 1 (Latest): TNode<Object> value, bool skip_smi_and_static_root_check, Label* if_true,
Victor Gomes . unresolved

This is a personal opinion, but I think booleans that split the control flow like that makes it hard to follow.

I'd rather see a `BranchIfToBooleanIsTrue(T<Object>, if_true, if_false)` and
`BranchIfToBooleanIsTrueNonOddballs(T<HeapObject>, ....)`

and then called in the BaselineCompiler.

Not a strong opinion, though.

Open in Gerrit

Related details

Attention is currently required from:
  • Leszek Swirski
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: I22d745e2d50223aaf433f143344870a01da72e0c
Gerrit-Change-Number: 7539376
Gerrit-PatchSet: 1
Gerrit-Owner: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Victor Gomes <victo...@chromium.org>
Gerrit-Attention: Leszek Swirski <les...@chromium.org>
Gerrit-Comment-Date: Tue, 03 Feb 2026 12:38:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Leszek Swirski (Gerrit)

unread,
Feb 3, 2026, 7:43:48 AM (21 hours ago) Feb 3
to Victor Gomes, V8 LUCI CQ, v8-re...@googlegroups.com
Attention needed from Victor Gomes

Leszek Swirski added 1 comment

File src/codegen/code-stub-assembler.cc
Line 1714, Patchset 1 (Latest): TNode<Object> value, bool skip_smi_and_static_root_check, Label* if_true,
Victor Gomes . unresolved

This is a personal opinion, but I think booleans that split the control flow like that makes it hard to follow.

I'd rather see a `BranchIfToBooleanIsTrue(T<Object>, if_true, if_false)` and
`BranchIfToBooleanIsTrueNonOddballs(T<HeapObject>, ....)`

and then called in the BaselineCompiler.

Not a strong opinion, though.

Leszek Swirski

I see your point, but it's a bit tricky with the additional `!V8_STATIC_ROOTS_BOOL` path split where we actually don't check for `Null` or `Undefined`, relying instead on the undetectable map check for them (meaning that `BranchIfToBooleanIsTrueNonOddballs` would have to carve out an exception for `Null`/`Undefined`). I also kind of like the duality here that we either branch or DCHECK on the checks that we can skip, maybe I can make that clearer by sharing more code between the branching vs DCHECKing paths?

Open in Gerrit

Related details

Attention is currently required from:
  • Victor Gomes
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: I22d745e2d50223aaf433f143344870a01da72e0c
Gerrit-Change-Number: 7539376
Gerrit-PatchSet: 1
Gerrit-Owner: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Victor Gomes <victo...@chromium.org>
Gerrit-Attention: Victor Gomes <victo...@chromium.org>
Gerrit-Comment-Date: Tue, 03 Feb 2026 12:43:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Victor Gomes <victo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Victor Gomes (Gerrit)

unread,
Feb 3, 2026, 7:52:26 AM (20 hours ago) Feb 3
to Leszek Swirski, V8 LUCI CQ, v8-re...@googlegroups.com
Attention needed from Leszek Swirski

Victor Gomes added 1 comment

File src/codegen/code-stub-assembler.cc
Line 1714, Patchset 1 (Latest): TNode<Object> value, bool skip_smi_and_static_root_check, Label* if_true,
Victor Gomes . resolved

This is a personal opinion, but I think booleans that split the control flow like that makes it hard to follow.

I'd rather see a `BranchIfToBooleanIsTrue(T<Object>, if_true, if_false)` and
`BranchIfToBooleanIsTrueNonOddballs(T<HeapObject>, ....)`

and then called in the BaselineCompiler.

Not a strong opinion, though.

Leszek Swirski

I see your point, but it's a bit tricky with the additional `!V8_STATIC_ROOTS_BOOL` path split where we actually don't check for `Null` or `Undefined`, relying instead on the undetectable map check for them (meaning that `BranchIfToBooleanIsTrueNonOddballs` would have to carve out an exception for `Null`/`Undefined`). I also kind of like the duality here that we either branch or DCHECK on the checks that we can skip, maybe I can make that clearer by sharing more code between the branching vs DCHECKing paths?

Victor Gomes

Fair enough. As I said, not very strong opinion here, since this is still a relatively simple CSA function.

Open in Gerrit

Related details

Attention is currently required from:
  • Leszek Swirski
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: I22d745e2d50223aaf433f143344870a01da72e0c
    Gerrit-Change-Number: 7539376
    Gerrit-PatchSet: 1
    Gerrit-Owner: Leszek Swirski <les...@chromium.org>
    Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
    Gerrit-Reviewer: Victor Gomes <victo...@chromium.org>
    Gerrit-Attention: Leszek Swirski <les...@chromium.org>
    Gerrit-Comment-Date: Tue, 03 Feb 2026 12:52:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Victor Gomes <victo...@chromium.org>
    Comment-In-Reply-To: Leszek Swirski <les...@chromium.org>
    satisfied_requirement
    open
    diffy

    Leszek Swirski (Gerrit)

    unread,
    Feb 3, 2026, 7:54:50 AM (20 hours ago) Feb 3
    to Victor Gomes, V8 LUCI CQ, v8-re...@googlegroups.com

    Leszek Swirski voted and added 1 comment

    Votes added by Leszek Swirski

    Commit-Queue+2

    1 comment

    File src/codegen/code-stub-assembler.cc
    Line 1714, Patchset 1 (Latest): TNode<Object> value, bool skip_smi_and_static_root_check, Label* if_true,
    Victor Gomes . resolved

    This is a personal opinion, but I think booleans that split the control flow like that makes it hard to follow.

    I'd rather see a `BranchIfToBooleanIsTrue(T<Object>, if_true, if_false)` and
    `BranchIfToBooleanIsTrueNonOddballs(T<HeapObject>, ....)`

    and then called in the BaselineCompiler.

    Not a strong opinion, though.

    Leszek Swirski

    I see your point, but it's a bit tricky with the additional `!V8_STATIC_ROOTS_BOOL` path split where we actually don't check for `Null` or `Undefined`, relying instead on the undetectable map check for them (meaning that `BranchIfToBooleanIsTrueNonOddballs` would have to carve out an exception for `Null`/`Undefined`). I also kind of like the duality here that we either branch or DCHECK on the checks that we can skip, maybe I can make that clearer by sharing more code between the branching vs DCHECKing paths?

    Victor Gomes

    Fair enough. As I said, not very strong opinion here, since this is still a relatively simple CSA function.

    Leszek Swirski

    Then I'll leave as-is because I like the DCHECKs (in case I screw up when the skipping is possible and when it isn't) 😊

    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: I22d745e2d50223aaf433f143344870a01da72e0c
    Gerrit-Change-Number: 7539376
    Gerrit-PatchSet: 1
    Gerrit-Owner: Leszek Swirski <les...@chromium.org>
    Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
    Gerrit-Reviewer: Victor Gomes <victo...@chromium.org>
    Gerrit-Comment-Date: Tue, 03 Feb 2026 12:54:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    V8 LUCI CQ (Gerrit)

    unread,
    Feb 3, 2026, 8:54:19 AM (19 hours ago) Feb 3
    to Leszek Swirski, Victor Gomes, v8-re...@googlegroups.com

    V8 LUCI CQ submitted the change

    Change information

    Commit message:
    [baseline] Optimize ToBooleanForBaselineJump for static roots

    Update BranchIfToBooleanIsTrue to optionally skip Smi and static root
    checks. Configure ToBooleanForBaselineJump to skip these checks when
    V8_STATIC_ROOTS is enabled, as they are already handled inline by
    the baseline compiler.
    Bug: 481232198
    Change-Id: I22d745e2d50223aaf433f143344870a01da72e0c
    Auto-Submit: Leszek Swirski <les...@chromium.org>
    Reviewed-by: Victor Gomes <victo...@chromium.org>
    Commit-Queue: Leszek Swirski <les...@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#105056}
    Files:
    • M src/builtins/base.tq
    • M src/builtins/conversion.tq
    • M src/codegen/code-stub-assembler.cc
    • M src/codegen/code-stub-assembler.h
    Change size: M
    Delta: 4 files changed, 56 insertions(+), 31 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Victor Gomes
    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: I22d745e2d50223aaf433f143344870a01da72e0c
    Gerrit-Change-Number: 7539376
    Gerrit-PatchSet: 2
    Gerrit-Owner: Leszek Swirski <les...@chromium.org>
    Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
    Gerrit-Reviewer: Victor Gomes <victo...@chromium.org>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages