| Index: src/heap/mark-compact.cc
|
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
|
| index 5f1c6de4a8f6fe98f91358f67b8e414fb2e91b5d..4fdb3abc4dae5ba9feb95c099da5a328e8aa3b7d 100644
|
| --- a/src/heap/mark-compact.cc
|
| +++ b/src/heap/mark-compact.cc
|
| @@ -1418,8 +1418,34 @@ class RootMarkingVisitor : public ObjectVisitor {
|
| void MarkObjectByPointer(Object** p) {
|
| if (!(*p)->IsHeapObject()) return;
|
|
|
| - // Replace flat cons strings in place.
|
| HeapObject* object = HeapObject::cast(*p);
|
| +
|
| + // We cannot avoid stale handles to left-trimmed objects, but can only make
|
| + // sure all handles still needed are updated. Filter out any stale pointers
|
| + // and clear the slot to allow post processing of handles (needed because
|
| + // the sweeper might actually free the underlying page).
|
| + if (object->IsFiller()) {
|
| +#ifdef DEBUG
|
| + // We need to find a FixedArrayBase map after walking the fillers.
|
| + Heap* heap = collector_->heap();
|
| + HeapObject* current = object;
|
| + while (current->IsFiller()) {
|
| + Address next = reinterpret_cast<Address>(current);
|
| + if (current->map() == heap->one_pointer_filler_map()) {
|
| + next += kPointerSize;
|
| + } else if (current->map() == heap->two_pointer_filler_map()) {
|
| + next += 2 * kPointerSize;
|
| + } else {
|
| + next += current->Size();
|
| + }
|
| + current = reinterpret_cast<HeapObject*>(next);
|
| + }
|
| + DCHECK(current->IsFixedArrayBase());
|
| +#endif // DEBUG
|
| + *p = nullptr;
|
| + return;
|
| + }
|
| +
|
| MarkBit mark_bit = Marking::MarkBitFrom(object);
|
| if (Marking::IsBlackOrGrey(mark_bit)) return;
|
|
|
|
|