[heap] Implement casting helpers for BasePage and friends [v8/v8 : main]

0 views
Skip to first unread message

Michael Lippautz (Gerrit)

unread,
Jan 9, 2026, 10:40:59 AM (3 days ago) Jan 9
to Leszek Swirski, Dominik Inführ, Hannes Payer, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Dominik Inführ and Leszek Swirski

Michael Lippautz voted and added 7 comments

Votes added by Michael Lippautz

Commit-Queue+1

7 comments

Patchset-level comments
File-level comment, Patchset 6 (Latest):
Michael Lippautz . resolved

ptal and lmk what you think here. This could all be implemented with XXX::Cast() methods as well but I do like the free standing casts in other areas actually.

I marked the broken casts on TOT which were all benign but technically wrong.

File src/heap/heap-allocator.cc
Line 235, Patchset 6 (Parent): NormalPage* page = NormalPage::FromHeapObject(object);
Michael Lippautz . resolved

This cast here was wrong as we don't know whether we are holding a `NormalPage` or `LargePage`.

File src/heap/large-spaces.cc
Line 304, Patchset 6 (Parent): NormalPage* page = NormalPage::FromHeapObject(object);
Michael Lippautz . resolved

This cast was wrong.

File src/heap/memory-allocator.cc
Line 299, Patchset 6 (Parent): if (!chunk->InReadOnlySpace()) {
Michael Lippautz . resolved

This can now be written much nicer.

File src/heap/paged-spaces-inl.h
Line 81, Patchset 6 (Parent): return NormalPage::FromAddress(heap()->isolate(), addr)->owner() == this;
Michael Lippautz . resolved

Wrong cast (and below) as we don't know the actual type of the page.

File src/objects/casting.h
Line 236, Patchset 6 (Latest):inline Derived& TrustedCppCast(
Michael Lippautz . unresolved

This is a bit annoying but `TrustedCast()` also seems to work with forward decls.

File src/roots/roots-inl.h
Line 139, Patchset 6 (Parent): CHECK_EQ(NormalPage::FromAddress(first_name_for_protector()),
Michael Lippautz . resolved

Wrong casts.

Open in Gerrit

Related details

Attention is currently required from:
  • Dominik Inführ
  • Leszek Swirski
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: I8e433c91b7a873fb5b65d40f8f46b16d65bfb657
Gerrit-Change-Number: 7414584
Gerrit-PatchSet: 6
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Leszek Swirski <les...@chromium.org>
Gerrit-Attention: Dominik Inführ <dinf...@chromium.org>
Gerrit-Comment-Date: Fri, 09 Jan 2026 15:40:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Michael Lippautz (Gerrit)

unread,
2:40 PM (7 hours ago) 2:40 PM
to V8 LUCI CQ, Leszek Swirski, Dominik Inführ, Hannes Payer, mlippau...@chromium.org, v8-re...@googlegroups.com, victorgo...@chromium.org
Attention needed from Dominik Inführ and Leszek Swirski

Michael Lippautz added 1 comment

Patchset-level comments
File-level comment, Patchset 16 (Latest):
Michael Lippautz . resolved

I split off the casting fixes and some stylistic stuff. This is ready now.

Open in Gerrit

Related details

Attention is currently required from:
  • Dominik Inführ
  • Leszek Swirski
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: I8e433c91b7a873fb5b65d40f8f46b16d65bfb657
Gerrit-Change-Number: 7414584
Gerrit-PatchSet: 16
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Dominik Inführ <dinf...@chromium.org>
Gerrit-Reviewer: Leszek Swirski <les...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Leszek Swirski <les...@chromium.org>
Gerrit-Attention: Dominik Inführ <dinf...@chromium.org>
Gerrit-Comment-Date: Mon, 12 Jan 2026 19:40:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages