diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index 4aa8aa37ec..dcf5b14bc6 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -4946,7 +4946,8 @@ class RememberedSetUpdatingItem : public UpdatingItem { return REMOVE_SLOT; } if (Heap::InFromPage(heap_object)) { - DCHECK(!v8_flags.minor_mc); + DCHECK_IMPLIES(v8_flags.minor_mc, + Page::FromHeapObject(heap_object)->IsLargePage()); MapWord map_word = heap_object.map_word(kRelaxedLoad); if (map_word.IsForwardingAddress()) { HeapObjectReference::Update(THeapObjectSlot(slot), diff --git a/test/unittests/heap/heap-unittest.cc b/test/unittests/heap/heap-unittest.cc index 0b48641910..7db368c292 100644 --- a/test/unittests/heap/heap-unittest.cc +++ b/test/unittests/heap/heap-unittest.cc @@ -228,7 +228,13 @@ TEST_F(HeapTest, GrowAndShrinkNewSpace) { old_capacity = new_space->TotalCapacity(); new_space->Shrink(); new_capacity = new_space->TotalCapacity(); - CHECK_EQ(old_capacity, 2 * new_capacity); + if (v8_flags.minor_mc) { + // Shrinking may not be able to remove any pages if all contain live + // objects. + CHECK_GE(old_capacity, new_capacity); + } else { + CHECK_EQ(old_capacity, 2 * new_capacity); + } // Consecutive shrinking should not affect space capacity. old_capacity = new_space->TotalCapacity();