[turboshaft] Support trusted loads in late load elimination [v8/v8 : main]

0 views
Skip to first unread message

Matthias Liedtke (Gerrit)

unread,
Dec 9, 2025, 8:18:18 AM12/9/25
to Darius Mercadier, Nico Hartmann, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
Attention needed from Darius Mercadier and Nico Hartmann

Matthias Liedtke voted and added 5 comments

Votes added by Matthias Liedtke

Commit-Queue+1

5 comments

Patchset-level comments
File-level comment, Patchset 9 (Latest):
Matthias Liedtke . resolved

@dmerc...@chromium.org: PTAL. I had a successful test run of all CQ bots on patch set 7 prior to hiding the feature behind `--future` (which might limit some combinations of variants).
@nicoha...@chromium.org: Please component-review `src/base/macros.h` but you're welcome to take a look at the other parts of the CL as well. 😊

File src/compiler/turboshaft/late-load-elimination-reducer.h
Line 1035, Patchset 9 (Latest): if (v8_flags.turboshaft_verify_load_elimination) {
Matthias Liedtke . unresolved

AFAICT this has zero coverage outside of fuzzers, right?
So we don't run this as part of any variant?

Line 829, Patchset 8: void EmitReportLoadEliminationError() {
Matthias Liedtke . unresolved

Mostly just moved (and slightly rewritten, so that the wasm part has an early return to reduce the amount of needed `#ifdef`s.)

Line 951, Patchset 4: EmitReportLoadEliminationError();
Matthias Liedtke . unresolved

How much do we think will it help to have different code locations for the different checks? After we had some OOM situations with this flag in Wasm in combination with another verification flag, would there bre any concerns about first joining all the error control flow and then emitting a single load? (I'd land that as a separate change.)
This would probably significantly reduce the graph size when the verification pass is enabled.

File src/compiler/turboshaft/load-store-simplification-reducer.h
Line 136, Patchset 9 (Latest): bool is_immutable,
Matthias Liedtke . unresolved

I focused on the case where this is `true`.
If it's true, this should mean we can either eliminate the whole load or there isn't much we can optimize.
I would hope that if this is `false`, the `ValueNumberingReducer` that runs in the same phase should still help us eliminating the shifts below if possible?

Open in Gerrit

Related details

Attention is currently required from:
  • Darius Mercadier
  • Nico Hartmann
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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
Gerrit-Change-Number: 7208978
Gerrit-PatchSet: 9
Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
Gerrit-CC: Samuel Groß <sa...@chromium.org>
Gerrit-Attention: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Attention: Nico Hartmann <nicoha...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Dec 2025 13:18:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
unsatisfied_requirement
open
diffy

Matthias Liedtke (Gerrit)

unread,
Dec 9, 2025, 8:25:40 AM12/9/25
to Darius Mercadier, Nico Hartmann, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
Attention needed from Darius Mercadier, Nico Hartmann and Samuel Groß

Matthias Liedtke added 1 comment

File src/compiler/turboshaft/operations.h
Line 360, Patchset 9 (Latest): IF_SANDBOX(V, LoadTrustedPointerField)
Matthias Liedtke . unresolved

Quick follow-up on the name: I acknowledge that @sa...@chromium.org went for `Decode`, not `Load`. I think from a performance perspective, `Load` is a bit more honest? It also makes it clearer that this isn't deterministic based on its inputs?

I don't have a strong opinion though. 😊

Open in Gerrit

Related details

Attention is currently required from:
  • Darius Mercadier
  • Nico Hartmann
  • Samuel Groß
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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
Gerrit-Change-Number: 7208978
Gerrit-PatchSet: 9
Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
Gerrit-CC: Samuel Groß <sa...@chromium.org>
Gerrit-Attention: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Attention: Nico Hartmann <nicoha...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Dec 2025 13:25:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Samuel Groß (Gerrit)

unread,
Dec 9, 2025, 8:43:13 AM12/9/25
to Matthias Liedtke, Darius Mercadier, Nico Hartmann, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
Attention needed from Darius Mercadier, Matthias Liedtke and Nico Hartmann

Samuel Groß added 1 comment

File src/compiler/turboshaft/operations.h
Line 360, Patchset 9 (Latest): IF_SANDBOX(V, LoadTrustedPointerField)
Matthias Liedtke . unresolved

Quick follow-up on the name: I acknowledge that @sa...@chromium.org went for `Decode`, not `Load`. I think from a performance perspective, `Load` is a bit more honest? It also makes it clearer that this isn't deterministic based on its inputs?

I don't have a strong opinion though. 😊

Samuel Groß

Yeah I think "load" is also fine. Elsewhere we also use "resolve" (e.g. https://source.chromium.org/chromium/chromium/src/+/main:v8/src/codegen/code-stub-assembler.h;l=1033;drc=54233b06577c8880f355dff17e33ef9c4075b082). I guess historically we've often used "decode" as a more opaque name if the operation behaved differently for sandbox vs no-sandbox configuration. But I guess here the new operation is only for the sandbox-enabled case.
Could you maybe still leave a TODO that it would be nice to have similar implementations for external pointers and trusted pointers? It's not super important, but would be nice to have, and is probably something that gemini could (soon) take care.

Open in Gerrit

Related details

Attention is currently required from:
  • Darius Mercadier
  • Matthias Liedtke
  • Nico Hartmann
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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
Gerrit-Change-Number: 7208978
Gerrit-PatchSet: 9
Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
Gerrit-CC: Samuel Groß <sa...@chromium.org>
Gerrit-Attention: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Attention: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Attention: Nico Hartmann <nicoha...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Dec 2025 13:43:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Matthias Liedtke <mlie...@chromium.org>
unsatisfied_requirement
open
diffy

Matthias Liedtke (Gerrit)

unread,
Dec 9, 2025, 9:19:27 AM12/9/25
to Darius Mercadier, Nico Hartmann, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
Attention needed from Darius Mercadier, Nico Hartmann and Samuel Groß

Matthias Liedtke added 1 comment

File src/compiler/turboshaft/operations.h
Line 360, Patchset 9 (Latest): IF_SANDBOX(V, LoadTrustedPointerField)
Matthias Liedtke . unresolved

Quick follow-up on the name: I acknowledge that @sa...@chromium.org went for `Decode`, not `Load`. I think from a performance perspective, `Load` is a bit more honest? It also makes it clearer that this isn't deterministic based on its inputs?

I don't have a strong opinion though. 😊

Samuel Groß

Yeah I think "load" is also fine. Elsewhere we also use "resolve" (e.g. https://source.chromium.org/chromium/chromium/src/+/main:v8/src/codegen/code-stub-assembler.h;l=1033;drc=54233b06577c8880f355dff17e33ef9c4075b082). I guess historically we've often used "decode" as a more opaque name if the operation behaved differently for sandbox vs no-sandbox configuration. But I guess here the new operation is only for the sandbox-enabled case.
Could you maybe still leave a TODO that it would be nice to have similar implementations for external pointers and trusted pointers? It's not super important, but would be nice to have, and is probably something that gemini could (soon) take care.

Matthias Liedtke

Isn't there `DecodeExternalPointer` already for external pointers (which was the reason you wanted to add the same for trusted pointers in your CL?)
Trusted pointers are what this CL is about and protected pointers (am I confusing them again?) are just regular tagged loads just with a different base, aren't they? They don't need a separate instruction, they can use LoadOp` (and already do I think?) as other than the base they really don't have any magic tags, tables, ...

Open in Gerrit

Related details

Attention is currently required from:
  • Darius Mercadier
  • Nico Hartmann
  • Samuel Groß
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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
Gerrit-Change-Number: 7208978
Gerrit-PatchSet: 9
Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
Gerrit-CC: Samuel Groß <sa...@chromium.org>
Gerrit-Attention: Darius Mercadier <dmerc...@chromium.org>
Gerrit-Attention: Samuel Groß <sa...@chromium.org>
Gerrit-Attention: Nico Hartmann <nicoha...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Dec 2025 14:19:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Samuel Groß <sa...@chromium.org>
Comment-In-Reply-To: Matthias Liedtke <mlie...@chromium.org>
unsatisfied_requirement
open
diffy

Darius Mercadier (Gerrit)

unread,
Dec 9, 2025, 9:22:53 AM12/9/25
to Matthias Liedtke, Nico Hartmann, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
Attention needed from Nico Hartmann and Samuel Groß

Darius Mercadier voted and added 6 comments

Votes added by Darius Mercadier

Code-Review+1

6 comments

Patchset-level comments
Darius Mercadier . resolved

lgtm

File src/compiler/turboshaft/late-load-elimination-reducer.h
Line 1035, Patchset 9 (Latest): if (v8_flags.turboshaft_verify_load_elimination) {
Matthias Liedtke . unresolved

AFAICT this has zero coverage outside of fuzzers, right?
So we don't run this as part of any variant?

Darius Mercadier

Yea good point. Maybe we should group all of those debugging flags behind a single one that would be enabled in one of the variants. I'll do it when I have a moment.

Line 829, Patchset 8: void EmitReportLoadEliminationError() {
Matthias Liedtke . resolved

Mostly just moved (and slightly rewritten, so that the wasm part has an early return to reduce the amount of needed `#ifdef`s.)

Darius Mercadier

Acknowledged

Line 951, Patchset 4: EmitReportLoadEliminationError();
Matthias Liedtke . unresolved

How much do we think will it help to have different code locations for the different checks? After we had some OOM situations with this flag in Wasm in combination with another verification flag, would there bre any concerns about first joining all the error control flow and then emitting a single load? (I'd land that as a separate change.)
This would probably significantly reduce the graph size when the verification pass is enabled.

Darius Mercadier

Yea perfectly fine, feel free to have a single place that emits the crashing code.

File src/compiler/turboshaft/late-load-elimination-reducer.cc
Line 404, Patchset 7: // We need to make sure that {load} and {replacement} have the same output
// representation. In particular, in unreachable code, it's possible that
Darius Mercadier . unresolved

You're not doing this though. Either add a `DCHECK(RepIsCompatible)` or a branch of `RepIsCompatible` like ProcessLoad does (and/or update this comment)

File src/compiler/turboshaft/load-store-simplification-reducer.h
Matthias Liedtke . resolved

I focused on the case where this is `true`.
If it's true, this should mean we can either eliminate the whole load or there isn't much we can optimize.
I would hope that if this is `false`, the `ValueNumberingReducer` that runs in the same phase should still help us eliminating the shifts below if possible?

Darius Mercadier

Yea I was thinking about the same thing, and indeed I think that GVN should remove the redundant shifts.

Open in Gerrit

Related details

Attention is currently required from:
  • Nico Hartmann
  • Samuel Groß
Submit Requirements:
    • requirement is not 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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
    Gerrit-Change-Number: 7208978
    Gerrit-PatchSet: 9
    Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
    Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
    Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
    Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
    Gerrit-CC: Samuel Groß <sa...@chromium.org>
    Gerrit-Attention: Samuel Groß <sa...@chromium.org>
    Gerrit-Attention: Nico Hartmann <nicoha...@chromium.org>
    Gerrit-Comment-Date: Tue, 09 Dec 2025 14:22:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Matthias Liedtke <mlie...@chromium.org>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Matthias Liedtke (Gerrit)

    unread,
    Dec 9, 2025, 10:03:18 AM12/9/25
    to Darius Mercadier, Nico Hartmann, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
    Attention needed from Nico Hartmann and Samuel Groß

    Matthias Liedtke added 2 comments

    File src/compiler/turboshaft/late-load-elimination-reducer.h
    Line 1035, Patchset 9: if (v8_flags.turboshaft_verify_load_elimination) {
    Matthias Liedtke . resolved

    AFAICT this has zero coverage outside of fuzzers, right?
    So we don't run this as part of any variant?

    Darius Mercadier

    Yea good point. Maybe we should group all of those debugging flags behind a single one that would be enabled in one of the variants. I'll do it when I have a moment.

    Matthias Liedtke

    Sounds good, resolving here as this is independent of this change (and hopefully my change won't fail on all our fuzzers. If it does, I'll revert. 😊)
    I checked locally and `--variants=turbolev_future --extra-flags=--turboshaft-verify-load-elimination` passes all tests.

    File src/compiler/turboshaft/late-load-elimination-reducer.cc
    Line 404, Patchset 7: // We need to make sure that {load} and {replacement} have the same output
    // representation. In particular, in unreachable code, it's possible that
    Darius Mercadier . resolved

    You're not doing this though. Either add a `DCHECK(RepIsCompatible)` or a branch of `RepIsCompatible` like ProcessLoad does (and/or update this comment)

    Matthias Liedtke

    Yeah, this comment is a left-over, thanks for flagging, I adapted the comment and changed the `DCHECK` below.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Nico Hartmann
    • Samuel Groß
    Submit Requirements:
    • requirement is not 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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
    Gerrit-Change-Number: 7208978
    Gerrit-PatchSet: 10
    Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
    Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
    Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
    Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
    Gerrit-CC: Samuel Groß <sa...@chromium.org>
    Gerrit-Attention: Samuel Groß <sa...@chromium.org>
    Gerrit-Attention: Nico Hartmann <nicoha...@chromium.org>
    Gerrit-Comment-Date: Tue, 09 Dec 2025 15:03:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Darius Mercadier <dmerc...@chromium.org>
    Comment-In-Reply-To: Matthias Liedtke <mlie...@chromium.org>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Samuel Groß (Gerrit)

    unread,
    Dec 9, 2025, 10:14:43 AM12/9/25
    to Matthias Liedtke, Darius Mercadier, Nico Hartmann, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
    Attention needed from Matthias Liedtke and Nico Hartmann

    Samuel Groß added 1 comment

    File src/compiler/turboshaft/operations.h
    Line 360, Patchset 9: IF_SANDBOX(V, LoadTrustedPointerField)
    Matthias Liedtke . unresolved

    Quick follow-up on the name: I acknowledge that @sa...@chromium.org went for `Decode`, not `Load`. I think from a performance perspective, `Load` is a bit more honest? It also makes it clearer that this isn't deterministic based on its inputs?

    I don't have a strong opinion though. 😊

    Samuel Groß

    Yeah I think "load" is also fine. Elsewhere we also use "resolve" (e.g. https://source.chromium.org/chromium/chromium/src/+/main:v8/src/codegen/code-stub-assembler.h;l=1033;drc=54233b06577c8880f355dff17e33ef9c4075b082). I guess historically we've often used "decode" as a more opaque name if the operation behaved differently for sandbox vs no-sandbox configuration. But I guess here the new operation is only for the sandbox-enabled case.
    Could you maybe still leave a TODO that it would be nice to have similar implementations for external pointers and trusted pointers? It's not super important, but would be nice to have, and is probably something that gemini could (soon) take care.

    Matthias Liedtke

    Isn't there `DecodeExternalPointer` already for external pointers (which was the reason you wanted to add the same for trusted pointers in your CL?)
    Trusted pointers are what this CL is about and protected pointers (am I confusing them again?) are just regular tagged loads just with a different base, aren't they? They don't need a separate instruction, they can use LoadOp` (and already do I think?) as other than the base they really don't have any magic tags, tables, ...

    Samuel Groß
    Yeah I guess what I mean is that it would be nice to have
    ```
    #define TURBOSHAFT_OTHER_OPERATION_LIST(V) \
    ...
    V(XyzExternalPointer) \
    V(XyzTrustedPointer)
    ```

    Or

    ```
    #define TURBOSHAFT_OTHER_OPERATION_LIST(V) \
    ...
    IF_SANDBOX(V, XyzExternalPointerField) \
    IF_SANDBOX(V, XyzTrustedPointerField)
    ```

    Or something like that. Since these two things are basically the same except for which table they use, it would be nice to handle them in a similar way. Low priority, but maybe worth leaving a TODO.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Matthias Liedtke
    • Nico Hartmann
    Submit Requirements:
    • requirement is not 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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
    Gerrit-Change-Number: 7208978
    Gerrit-PatchSet: 10
    Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
    Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
    Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
    Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
    Gerrit-CC: Samuel Groß <sa...@chromium.org>
    Gerrit-Attention: Matthias Liedtke <mlie...@chromium.org>
    Gerrit-Attention: Nico Hartmann <nicoha...@chromium.org>
    Gerrit-Comment-Date: Tue, 09 Dec 2025 15:14:37 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Matthias Liedtke (Gerrit)

    unread,
    Dec 9, 2025, 10:30:31 AM12/9/25
    to Darius Mercadier, Nico Hartmann, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
    Attention needed from Nico Hartmann and Samuel Groß

    Matthias Liedtke voted and added 1 comment

    Votes added by Matthias Liedtke

    Auto-Submit+1

    1 comment

    File src/compiler/turboshaft/operations.h
    Line 360, Patchset 9: IF_SANDBOX(V, LoadTrustedPointerField)
    Matthias Liedtke . resolved

    Quick follow-up on the name: I acknowledge that @sa...@chromium.org went for `Decode`, not `Load`. I think from a performance perspective, `Load` is a bit more honest? It also makes it clearer that this isn't deterministic based on its inputs?

    I don't have a strong opinion though. 😊

    Samuel Groß

    Yeah I think "load" is also fine. Elsewhere we also use "resolve" (e.g. https://source.chromium.org/chromium/chromium/src/+/main:v8/src/codegen/code-stub-assembler.h;l=1033;drc=54233b06577c8880f355dff17e33ef9c4075b082). I guess historically we've often used "decode" as a more opaque name if the operation behaved differently for sandbox vs no-sandbox configuration. But I guess here the new operation is only for the sandbox-enabled case.
    Could you maybe still leave a TODO that it would be nice to have similar implementations for external pointers and trusted pointers? It's not super important, but would be nice to have, and is probably something that gemini could (soon) take care.

    Matthias Liedtke

    Isn't there `DecodeExternalPointer` already for external pointers (which was the reason you wanted to add the same for trusted pointers in your CL?)
    Trusted pointers are what this CL is about and protected pointers (am I confusing them again?) are just regular tagged loads just with a different base, aren't they? They don't need a separate instruction, they can use LoadOp` (and already do I think?) as other than the base they really don't have any magic tags, tables, ...

    Samuel Groß
    Yeah I guess what I mean is that it would be nice to have
    ```
    #define TURBOSHAFT_OTHER_OPERATION_LIST(V) \
    ...
    V(XyzExternalPointer) \
    V(XyzTrustedPointer)
    ```

    Or

    ```
    #define TURBOSHAFT_OTHER_OPERATION_LIST(V) \
    ...
    IF_SANDBOX(V, XyzExternalPointerField) \
    IF_SANDBOX(V, XyzTrustedPointerField)
    ```

    Or something like that. Since these two things are basically the same except for which table they use, it would be nice to handle them in a similar way. Low priority, but maybe worth leaving a TODO.

    Matthias Liedtke

    Got it, then I also agree on the feasibility of telling Gemini to do it. 😊
    I might just try it tomorrow if I don't get too much disrupted by other stuff.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Nico Hartmann
    • Samuel Groß
    Submit Requirements:
    • requirement is not 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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
    Gerrit-Change-Number: 7208978
    Gerrit-PatchSet: 11
    Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
    Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
    Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
    Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
    Gerrit-CC: Samuel Groß <sa...@chromium.org>
    Gerrit-Attention: Samuel Groß <sa...@chromium.org>
    Gerrit-Attention: Nico Hartmann <nicoha...@chromium.org>
    Gerrit-Comment-Date: Tue, 09 Dec 2025 15:30:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Matthias Liedtke (Gerrit)

    unread,
    Dec 9, 2025, 10:54:33 AM12/9/25
    to Darius Mercadier, Nico Hartmann, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
    Attention needed from Samuel Groß

    Matthias Liedtke added 1 comment

    File src/compiler/turboshaft/late-load-elimination-reducer.h
    Line 951, Patchset 4: EmitReportLoadEliminationError();
    Matthias Liedtke . resolved

    How much do we think will it help to have different code locations for the different checks? After we had some OOM situations with this flag in Wasm in combination with another verification flag, would there bre any concerns about first joining all the error control flow and then emitting a single load? (I'd land that as a separate change.)
    This would probably significantly reduce the graph size when the verification pass is enabled.

    Darius Mercadier

    Yea perfectly fine, feel free to have a single place that emits the crashing code.

    Attention is currently required from:
    • Samuel Groß
    Submit Requirements:
      • requirement is not 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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
      Gerrit-Change-Number: 7208978
      Gerrit-PatchSet: 11
      Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
      Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
      Gerrit-CC: Samuel Groß <sa...@chromium.org>
      Gerrit-Attention: Samuel Groß <sa...@chromium.org>
      Gerrit-Comment-Date: Tue, 09 Dec 2025 15:54:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Nico Hartmann (Gerrit)

      unread,
      Dec 9, 2025, 10:56:40 AM12/9/25
      to Matthias Liedtke, Darius Mercadier, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
      Attention needed from Matthias Liedtke and Samuel Groß

      Nico Hartmann added 1 comment

      Patchset-level comments
      File-level comment, Patchset 11 (Latest):
      Nico Hartmann . resolved

      src/base LGTM

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Matthias Liedtke
      • Samuel Groß
      Submit Requirements:
      • requirement is not 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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
      Gerrit-Change-Number: 7208978
      Gerrit-PatchSet: 11
      Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
      Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
      Gerrit-CC: Samuel Groß <sa...@chromium.org>
      Gerrit-Attention: Samuel Groß <sa...@chromium.org>
      Gerrit-Attention: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Comment-Date: Tue, 09 Dec 2025 15:56:34 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Nico Hartmann (Gerrit)

      unread,
      Dec 9, 2025, 10:56:46 AM12/9/25
      to Matthias Liedtke, Darius Mercadier, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
      Attention needed from Matthias Liedtke and Samuel Groß

      Nico Hartmann voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Matthias Liedtke
      • Samuel Groß
      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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
      Gerrit-Change-Number: 7208978
      Gerrit-PatchSet: 11
      Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
      Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
      Gerrit-CC: Samuel Groß <sa...@chromium.org>
      Gerrit-Attention: Samuel Groß <sa...@chromium.org>
      Gerrit-Attention: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Comment-Date: Tue, 09 Dec 2025 15:56:41 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Matthias Liedtke (Gerrit)

      unread,
      Dec 9, 2025, 10:57:51 AM12/9/25
      to Nico Hartmann, Darius Mercadier, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, V8 LUCI CQ, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com
      Attention needed from Samuel Groß

      Matthias Liedtke voted and added 1 comment

      Votes added by Matthias Liedtke

      Commit-Queue+2

      1 comment

      Patchset-level comments
      Matthias Liedtke . resolved

      Thanks!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Samuel Groß
      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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
      Gerrit-Change-Number: 7208978
      Gerrit-PatchSet: 11
      Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
      Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
      Gerrit-CC: Samuel Groß <sa...@chromium.org>
      Gerrit-Attention: Samuel Groß <sa...@chromium.org>
      Gerrit-Comment-Date: Tue, 09 Dec 2025 15:57:46 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      V8 LUCI CQ (Gerrit)

      unread,
      Dec 9, 2025, 11:36:59 AM12/9/25
      to Matthias Liedtke, Nico Hartmann, Darius Mercadier, Samuel Groß, AyeAye, chrom...@appspot.gserviceaccount.com, v8-flag...@chromium.org, dmercadi...@chromium.org, v8-re...@googlegroups.com, was...@google.com

      V8 LUCI CQ submitted the change

      Change information

      Commit message:
      [turboshaft] Support trusted loads in late load elimination

      This change adds a new LoadTrustedPointerField operation in Turboshaft
      to support load elimination of trusted loads. These loads are very
      relevant for Wasm, e.g. for inlined wrappers which need to follow a
      long pointer chain with an intermediate trusted load to get from a
      JSFunction to the actual Wasm code pointer on calling it.

      For now, this new feature is staged behind --future (while the marking
      of some of these loads inside the Wasm wrappers as immutable is
      directly done without a feature flag.
      Bug: 465068841
      Change-Id: Id1a98b744090e7c5acc89ea541f8863bdc432c93
      Reviewed-by: Nico Hartmann <nicoha...@chromium.org>
      Reviewed-by: Darius Mercadier <dmerc...@chromium.org>
      Auto-Submit: Matthias Liedtke <mlie...@chromium.org>
      Commit-Queue: Matthias Liedtke <mlie...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#104209}
      Files:
      • M src/base/macros.h
      • M src/compiler/turboshaft/assembler.h
      • M src/compiler/turboshaft/late-load-elimination-reducer.cc
      • M src/compiler/turboshaft/late-load-elimination-reducer.h
      • M src/compiler/turboshaft/load-store-simplification-reducer.h
      • M src/compiler/turboshaft/operations.h
      • M src/flags/flag-definitions.h
      • M src/wasm/wrappers-inl.h
      Change size: L
      Delta: 8 files changed, 205 insertions(+), 49 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Nico Hartmann, +1 by Darius Mercadier
      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: Id1a98b744090e7c5acc89ea541f8863bdc432c93
      Gerrit-Change-Number: 7208978
      Gerrit-PatchSet: 12
      Gerrit-Owner: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Reviewer: Darius Mercadier <dmerc...@chromium.org>
      Gerrit-Reviewer: Matthias Liedtke <mlie...@chromium.org>
      Gerrit-Reviewer: Nico Hartmann <nicoha...@chromium.org>
      Gerrit-CC: Samuel Groß <sa...@chromium.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages