Commit 4e0da20d authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Fix DCHECK in FixStaleLeftTrimmedHandlesVisitor

This adds a guard for a forwarding address in the debug mode checks
of FixStaleLeftTrimmedHandlesVisitor::FixHandle.

Bug: chromium:1146601
Change-Id: I6681352a91177c1d138a409d17e5d170bd43f11b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2526389
Auto-Submit: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71055}
parent 4510401d
...@@ -4314,11 +4314,12 @@ class FixStaleLeftTrimmedHandlesVisitor : public RootVisitor { ...@@ -4314,11 +4314,12 @@ class FixStaleLeftTrimmedHandlesVisitor : public RootVisitor {
inline void FixHandle(FullObjectSlot p) { inline void FixHandle(FullObjectSlot p) {
if (!(*p).IsHeapObject()) return; if (!(*p).IsHeapObject()) return;
HeapObject current = HeapObject::cast(*p); HeapObject current = HeapObject::cast(*p);
const MapWord map_word = current.map_word(); if (!current.map_word().IsForwardingAddress() &&
if (!map_word.IsForwardingAddress() && current.IsFreeSpaceOrFiller()) { current.IsFreeSpaceOrFiller()) {
#ifdef DEBUG #ifdef DEBUG
// We need to find a FixedArrayBase map after walking the fillers. // We need to find a FixedArrayBase map after walking the fillers.
while (current.IsFreeSpaceOrFiller()) { while (!current.map_word().IsForwardingAddress() &&
current.IsFreeSpaceOrFiller()) {
Address next = current.ptr(); Address next = current.ptr();
if (current.map() == ReadOnlyRoots(heap_).one_pointer_filler_map()) { if (current.map() == ReadOnlyRoots(heap_).one_pointer_filler_map()) {
next += kTaggedSize; next += kTaggedSize;
...@@ -4330,7 +4331,8 @@ class FixStaleLeftTrimmedHandlesVisitor : public RootVisitor { ...@@ -4330,7 +4331,8 @@ class FixStaleLeftTrimmedHandlesVisitor : public RootVisitor {
} }
current = HeapObject::cast(Object(next)); current = HeapObject::cast(Object(next));
} }
DCHECK(current.IsFixedArrayBase()); DCHECK(current.map_word().IsForwardingAddress() ||
current.IsFixedArrayBase());
#endif // DEBUG #endif // DEBUG
p.store(Smi::zero()); p.store(Smi::zero());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment