[heap] Fix tests for MinorMC

SimulateFullSpace starts with no LAB, iterates over pages and allocates
all free space on each page. After the first page, the LAB is empty but
is no longer null.

Bug: v8:12612
Change-Id: I2c00b9ba68fdd5f60eda086ea940cb6e211a986e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3891294
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83186}
This commit is contained in:
Omer Katz 2022-09-14 00:08:35 +02:00 committed by V8 LUCI CQ
parent 7fce6dec89
commit 8e4e35090b
4 changed files with 9 additions and 8 deletions

View File

@ -139,8 +139,9 @@ void FillPageInPagedSpace(Page* page,
std::vector<Handle<FixedArray>>* out_handles) {
DCHECK(page->SweepingDone());
PagedSpaceBase* paged_space = static_cast<PagedSpaceBase*>(page->owner());
DCHECK_EQ(kNullAddress, paged_space->top());
DCHECK(!page->Contains(paged_space->top()));
// Make sure the LAB is empty to guarantee that all free space is accounted
// for in the freelist.
DCHECK_EQ(paged_space->limit(), paged_space->top());
for (Page* p : *paged_space) {
if (p != page) paged_space->UnlinkFreeListCategories(p);

View File

@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "src/api/api-inl.h"
#include "src/common/globals.h"
#include "src/execution/isolate.h"
#include "src/heap/array-buffer-sweeper.h"
#include "src/heap/heap-inl.h"
@ -455,8 +456,7 @@ TEST(ArrayBuffer_ExternalBackingStoreSizeIncreasesMarkCompact) {
v8::ArrayBuffer::New(isolate, kArraybufferSize);
Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1);
CHECK(IsTracked(heap, *buf1));
heap::GcAndSweep(heap, NEW_SPACE);
heap::GcAndSweep(heap, NEW_SPACE);
heap::GcAndSweep(heap, OLD_SPACE);
Page* page_before_gc = Page::FromHeapObject(*buf1);
heap::ForceEvacuationCandidate(page_before_gc);

View File

@ -373,8 +373,7 @@ TEST_F(HeapTest, Regress978156) {
Heap* heap = isolate()->heap();
// 1. Ensure that the new space is empty.
CollectGarbage(NEW_SPACE);
CollectGarbage(NEW_SPACE);
GcAndSweep(OLD_SPACE);
// 2. Fill the new space with FixedArrays.
std::vector<Handle<FixedArray>> arrays;
SimulateFullSpace(heap->new_space(), &arrays);

View File

@ -54,8 +54,9 @@ void FillPageInPagedSpace(Page* page,
std::vector<Handle<FixedArray>>* out_handles) {
DCHECK(page->SweepingDone());
PagedSpaceBase* paged_space = static_cast<PagedSpaceBase*>(page->owner());
DCHECK_EQ(kNullAddress, paged_space->top());
DCHECK(!page->Contains(paged_space->top()));
// Make sure the LAB is empty to guarantee that all free space is accounted
// for in the freelist.
DCHECK_EQ(paged_space->limit(), paged_space->top());
for (Page* p : *paged_space) {
if (p != page) paged_space->UnlinkFreeListCategories(p);