[objects] Add a HashSeedWrapper for HashSeed data [v8/v8 : main]

0 views
Skip to first unread message

Leszek Swirski (Gerrit)

unread,
Jun 2, 2026, 7:46:44 AM (8 days ago) Jun 2
to Jakob Kummerow, android-bu...@system.gserviceaccount.com, Hannes Payer, jgrube...@chromium.org, pthier...@chromium.org, dmercadi...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Jakob Kummerow

Leszek Swirski voted and added 2 comments

Votes added by Leszek Swirski

Commit-Queue+1

2 comments

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

PTAL

File src/numbers/hash-seed-inl.h
Line 9, Patchset 6 (Parent):#include "src/objects/fixed-array-inl.h"
Leszek Swirski . unresolved

The mission: removing this include.

Open in Gerrit

Related details

Attention is currently required from:
  • Jakob Kummerow
Submit Requirements:
  • requirement 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: I565696a68e516c9cd0fe8d3853840e4cda81334f
Gerrit-Change-Number: 7890198
Gerrit-PatchSet: 9
Gerrit-Owner: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Comment-Date: Tue, 02 Jun 2026 11:46:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Jakob Kummerow (Gerrit)

unread,
Jun 2, 2026, 8:35:48 AM (8 days ago) Jun 2
to Leszek Swirski, Jakob Kummerow, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, Hannes Payer, jgrube...@chromium.org, pthier...@chromium.org, dmercadi...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Leszek Swirski

Jakob Kummerow voted and added 9 comments

Votes added by Jakob Kummerow

Code-Review+1

9 comments

Patchset-level comments
File-level comment, Patchset 10 (Latest):
Jakob Kummerow . resolved

Love it! Just minor comments.

High-level: if I knew an expert for HeapObject layout definitions (😉), I'd ask them why `HashSeed`, `HashSeed::Data`, and `HashSeedWrapper` are three separate classes. In the old world, where one was a convenience view over a ByteArray storing the second, it kind of made sense, but in the new world, couldn't it be just _one_ class?

File src/diagnostics/objects-debug.cc
Line 319, Patchset 9: Cast<HashSeedWrapper>(this)->HashSeedWrapperVerify(isolate);
Jakob Kummerow . resolved

Unrelated to this CL: a cleanup I've been wanting to do for a long time is deciding what "object verification" should really do. As of this CL, what we're implementing is:

```
switch (map()->instance_type()) {
case HASH_SEED_WRAPPER_TYPE:
CHECK(IsHashSeedWrapper(this)); // Instance type check.
break;
}
```

which isn't really useful (if it's a Foo, check that it's a Foo!). It's consistent with plenty of precedent though, so I guess we rather keep this than just not have an implementation at all...

File src/heap/factory.h
Line 147, Patchset 9: template <AllocationType allocation = AllocationType::kYoung>
Jakob Kummerow . unresolved

I think this should be a regular function parameter (see e.g. line 164 for an example).
(We could even drop it entirely: AFAICS only the `AllocationType::kReadOnly` version is ever used. OTOH even if we currently don't have other users, having the parameter makes the behavior explicit.)

File src/numbers/hash-seed-inl.h
Line 9, Patchset 6 (Parent):#include "src/objects/fixed-array-inl.h"
Leszek Swirski . resolved

The mission: removing this include.

Jakob Kummerow

\o/

File src/numbers/hash-seed.cc
Line 95, Patchset 9 (Parent): Data* data = const_cast<Data*>(HashSeed(isolate).data_);
Jakob Kummerow . unresolved

I think if this was changed to `ReadOnlyRoots(isolate).hash_seed()->data()`, then the lines below could remain what they were. Was it an intentional choice to switch from writing into the object directly to accumulating an on-stack `Data` first before whole-sale memcopying it over? (I don't mind much either way.)

File src/objects/hash-seed-wrapper.h
Line 20, Patchset 9: // Getters and setters for fields.
Jakob Kummerow . unresolved

nit: useless comment.

File src/objects/heap-object-inl.h
Line 12, Patchset 9:#include "src/heap/read-only-heap-inl.h"
Jakob Kummerow . unresolved

Not so sure about this; given how common `heap-object-inl.h` is I'd like to keep it as lean as possible.
Would it work to include `read-only-heap-inl.h` only in `string-inl.h`, and replace the two calls to `EarlyGetReadOnlyRoots()` in there with their inlined version `ReadOnlyHeap::EarlyGetReadOnlyRoots(this)`?

File src/objects/objects-inl.h
Line 39, Patchset 9:#include "src/objects/heap-object.h"
Jakob Kummerow . unresolved

Not needed if we have the `-inl.h` version.

(Interesting that we didn't need the latter here before. Probably came in transitively?)

File src/objects/string-inl.h
Line 36, Patchset 9:#include "src/sandbox/external-pointer.h"
Jakob Kummerow . unresolved

Not needed.

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: I565696a68e516c9cd0fe8d3853840e4cda81334f
Gerrit-Change-Number: 7890198
Gerrit-PatchSet: 10
Gerrit-Owner: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Leszek Swirski <les...@chromium.org>
Gerrit-Comment-Date: Tue, 02 Jun 2026 12:35:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Leszek Swirski <les...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Leszek Swirski (Gerrit)

unread,
Jun 8, 2026, 9:22:37 AM (2 days ago) Jun 8
to Jakob Kummerow, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, Hannes Payer, jgrube...@chromium.org, pthier...@chromium.org, dmercadi...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Jakob Kummerow

Leszek Swirski voted and added 7 comments

Votes added by Leszek Swirski

Commit-Queue+1

7 comments

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

PTAL again (hopefully bots will be green)

File src/heap/factory.h
Line 147, Patchset 9: template <AllocationType allocation = AllocationType::kYoung>
Jakob Kummerow . resolved

I think this should be a regular function parameter (see e.g. line 164 for an example).
(We could even drop it entirely: AFAICS only the `AllocationType::kReadOnly` version is ever used. OTOH even if we currently don't have other users, having the parameter makes the behavior explicit.)

Leszek Swirski

Done (stupid AI cargo culting)

File src/numbers/hash-seed.cc
Line 95, Patchset 9: Data data;
Jakob Kummerow . resolved

I think if this was changed to `ReadOnlyRoots(isolate).hash_seed()->data()`, then the lines below could remain what they were. Was it an intentional choice to switch from writing into the object directly to accumulating an on-stack `Data` first before whole-sale memcopying it over? (I don't mind much either way.)

Leszek Swirski

not intentional, a consequence of an intermediate state.

File src/objects/hash-seed-wrapper.h
Line 20, Patchset 9: // Getters and setters for fields.
Jakob Kummerow . resolved

nit: useless comment.

Leszek Swirski

Done

File src/objects/heap-object-inl.h
Line 12, Patchset 9:#include "src/heap/read-only-heap-inl.h"
Jakob Kummerow . resolved

Not so sure about this; given how common `heap-object-inl.h` is I'd like to keep it as lean as possible.
Would it work to include `read-only-heap-inl.h` only in `string-inl.h`, and replace the two calls to `EarlyGetReadOnlyRoots()` in there with their inlined version `ReadOnlyHeap::EarlyGetReadOnlyRoots(this)`?

Leszek Swirski

Nice, done.

File src/objects/objects-inl.h
Line 39, Patchset 9:#include "src/objects/heap-object.h"
Jakob Kummerow . resolved

Not needed if we have the `-inl.h` version.

(Interesting that we didn't need the latter here before. Probably came in transitively?)

Leszek Swirski

Done

File src/objects/string-inl.h
Line 36, Patchset 9:#include "src/sandbox/external-pointer.h"
Jakob Kummerow . resolved

Not needed.

Leszek Swirski

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Jakob Kummerow
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: I565696a68e516c9cd0fe8d3853840e4cda81334f
Gerrit-Change-Number: 7890198
Gerrit-PatchSet: 18
Gerrit-Attention: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Comment-Date: Mon, 08 Jun 2026 13:22:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Jakob Kummerow <jkum...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Jakob Kummerow (Gerrit)

unread,
Jun 9, 2026, 7:51:08 AM (21 hours ago) Jun 9
to Leszek Swirski, Jakob Kummerow, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, Hannes Payer, jgrube...@chromium.org, pthier...@chromium.org, dmercadi...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Leszek Swirski

Jakob Kummerow voted Code-Review+1

Code-Review+1
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: I565696a68e516c9cd0fe8d3853840e4cda81334f
Gerrit-Change-Number: 7890198
Gerrit-PatchSet: 18
Gerrit-Owner: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Leszek Swirski <les...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Jun 2026 11:51:04 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Jakob Kummerow (Gerrit)

unread,
Jun 9, 2026, 9:02:38 AM (20 hours ago) Jun 9
to Leszek Swirski, Jakob Kummerow, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, Hannes Payer, jgrube...@chromium.org, pthier...@chromium.org, dmercadi...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Leszek Swirski

Jakob Kummerow voted Code-Review+1

Code-Review+1
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: I565696a68e516c9cd0fe8d3853840e4cda81334f
Gerrit-Change-Number: 7890198
Gerrit-PatchSet: 19
Gerrit-Owner: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Leszek Swirski <les...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Jun 2026 13:02:31 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Leszek Swirski (Gerrit)

unread,
Jun 9, 2026, 10:22:08 AM (19 hours ago) Jun 9
to Jakob Kummerow, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, Hannes Payer, jgrube...@chromium.org, pthier...@chromium.org, dmercadi...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Jakob Kummerow

Leszek Swirski voted and added 1 comment

Votes added by Leszek Swirski

Auto-Submit+1

1 comment

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

please restamp after spurious test change removed.

Open in Gerrit

Related details

Attention is currently required from:
  • Jakob Kummerow
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: I565696a68e516c9cd0fe8d3853840e4cda81334f
Gerrit-Change-Number: 7890198
Gerrit-PatchSet: 20
Gerrit-Attention: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Jun 2026 14:22:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Jakob Kummerow (Gerrit)

unread,
Jun 9, 2026, 10:50:40 AM (18 hours ago) Jun 9
to Leszek Swirski, Jakob Kummerow, v8-s...@luci-project-accounts.iam.gserviceaccount.com, android-bu...@system.gserviceaccount.com, Hannes Payer, jgrube...@chromium.org, pthier...@chromium.org, dmercadi...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Leszek Swirski

Jakob Kummerow voted

Code-Review+1
Commit-Queue+2
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: I565696a68e516c9cd0fe8d3853840e4cda81334f
Gerrit-Change-Number: 7890198
Gerrit-PatchSet: 20
Gerrit-Owner: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Leszek Swirski <les...@chromium.org>
Gerrit-Comment-Date: Tue, 09 Jun 2026 14:50:34 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

v8-scoped@luci-project-accounts.iam.gserviceaccount.com (Gerrit)

unread,
Jun 9, 2026, 12:11:20 PM (17 hours ago) Jun 9
to Leszek Swirski, Jakob Kummerow, android-bu...@system.gserviceaccount.com, Hannes Payer, jgrube...@chromium.org, pthier...@chromium.org, dmercadi...@chromium.org, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org

v8-s...@luci-project-accounts.iam.gserviceaccount.com submitted the change

Change information

Commit message:
[objects] Add a HashSeedWrapper for HashSeed data

Refactor V8 string hash seed storage to use a newly introduced
HashSeedWrapper instead of a raw ByteArray in the read-only roots.

- Introduced HashSeedWrapper in roots.h and allocated it during heap
bootstrap.
- Wrapped the HashSeed::Data struct in UnalignedValueMember inside
HashSeedWrapper. It's unaligned relative to the struct alignment
because of the map pointer, but we ensure that it is allocated so that
the data itself is aligned by setting alignment dynamically based on
offsetof(HashSeedWrapper, data_).
- Restructured header dependencies to remove indirect objects-inl.h
inclusion from string-inl.h via
hash-seed-inl.h -> fixed-array-inl.h.
- This required moving CastTraits for Map and Symbol to
heap-object-inl.h.
- Also removed objects-inl.h from fixed-array-inl.h, though it still
includes it indirectly via factory-inl.h -- future work.
- Use ReadOnlyHeap::EarlyGetReadOnlyRoots directly instead of forcing
heap-object-inl.h to include it,

NO_IFTTT=Internal type, doesn't need compiler or JSObject handling.
TAG=agy
CONV=395db713-363f-4d55-9ebe-4fff13064bf3
Change-Id: I565696a68e516c9cd0fe8d3853840e4cda81334f
Commit-Queue: Jakob Kummerow <jkum...@chromium.org>
Commit-Queue: Leszek Swirski <les...@chromium.org>
Auto-Submit: Leszek Swirski <les...@chromium.org>
Reviewed-by: Jakob Kummerow <jkum...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#107865}
Files:
  • M BUILD.bazel
  • M BUILD.gn
  • M src/builtins/base.tq
  • M src/codegen/code-stub-assembler.cc
  • M src/compiler/heap-refs.h
  • M src/deoptimizer/frame-translation-builder.cc
  • M src/diagnostics/objects-debug.cc
  • M src/diagnostics/objects-printer.cc
  • M src/heap/factory.cc
  • M src/heap/factory.h
  • M src/heap/heap-visitor.h
  • M src/heap/setup-heap-internal.cc
  • M src/numbers/hash-seed-inl.h
  • M src/numbers/hash-seed.cc
  • M src/numbers/hash-seed.h
  • M src/objects/all-objects-inl.h
  • M src/objects/descriptor-array-inl.h
  • M src/objects/fixed-array-inl.h
  • A src/objects/hash-seed-wrapper-inl.h
  • A src/objects/hash-seed-wrapper.h
  • M src/objects/heap-object-inl.h
  • M src/objects/heap-object.h
  • M src/objects/map.cc
  • M src/objects/map.h
  • M src/objects/name-inl.h
  • M src/objects/object-list-macros.h
  • M src/objects/objects-body-descriptors-inl.h
  • M src/objects/objects-inl.h
  • M src/objects/objects.cc
  • M src/objects/scope-info.cc
  • M src/objects/shared-function-info-inl.h
  • M src/objects/string-inl.h
  • M src/objects/string.cc
  • M src/objects/tagged-field.h
  • M src/regexp/experimental/experimental-interpreter.cc
  • M src/roots/roots.h
  • M src/roots/static-roots-intl-nowasm.h
  • M src/roots/static-roots-intl-wasm.h
  • M src/roots/static-roots-nointl-nowasm.h
  • M src/roots/static-roots-nointl-wasm.h
Change size: L
Delta: 40 files changed, 237 insertions(+), 80 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Jakob Kummerow
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: I565696a68e516c9cd0fe8d3853840e4cda81334f
Gerrit-Change-Number: 7890198
Gerrit-PatchSet: 21
Gerrit-Owner: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Jakob Kummerow <jkum...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages