Commit 8e4e3509 authored by Omer Katz's avatar Omer Katz Committed by V8 LUCI CQ

[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: 's avatarDominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83186}
parent 7fce6dec
...@@ -139,8 +139,9 @@ void FillPageInPagedSpace(Page* page, ...@@ -139,8 +139,9 @@ void FillPageInPagedSpace(Page* page,
std::vector<Handle<FixedArray>>* out_handles) { std::vector<Handle<FixedArray>>* out_handles) {
DCHECK(page->SweepingDone()); DCHECK(page->SweepingDone());
PagedSpaceBase* paged_space = static_cast<PagedSpaceBase*>(page->owner()); PagedSpaceBase* paged_space = static_cast<PagedSpaceBase*>(page->owner());
DCHECK_EQ(kNullAddress, paged_space->top()); // Make sure the LAB is empty to guarantee that all free space is accounted
DCHECK(!page->Contains(paged_space->top())); // for in the freelist.
DCHECK_EQ(paged_space->limit(), paged_space->top());
for (Page* p : *paged_space) { for (Page* p : *paged_space) {
if (p != page) paged_space->UnlinkFreeListCategories(p); if (p != page) paged_space->UnlinkFreeListCategories(p);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "src/api/api-inl.h" #include "src/api/api-inl.h"
#include "src/common/globals.h"
#include "src/execution/isolate.h" #include "src/execution/isolate.h"
#include "src/heap/array-buffer-sweeper.h" #include "src/heap/array-buffer-sweeper.h"
#include "src/heap/heap-inl.h" #include "src/heap/heap-inl.h"
...@@ -455,8 +456,7 @@ TEST(ArrayBuffer_ExternalBackingStoreSizeIncreasesMarkCompact) { ...@@ -455,8 +456,7 @@ TEST(ArrayBuffer_ExternalBackingStoreSizeIncreasesMarkCompact) {
v8::ArrayBuffer::New(isolate, kArraybufferSize); v8::ArrayBuffer::New(isolate, kArraybufferSize);
Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1);
CHECK(IsTracked(heap, *buf1)); CHECK(IsTracked(heap, *buf1));
heap::GcAndSweep(heap, NEW_SPACE); heap::GcAndSweep(heap, OLD_SPACE);
heap::GcAndSweep(heap, NEW_SPACE);
Page* page_before_gc = Page::FromHeapObject(*buf1); Page* page_before_gc = Page::FromHeapObject(*buf1);
heap::ForceEvacuationCandidate(page_before_gc); heap::ForceEvacuationCandidate(page_before_gc);
......
...@@ -373,8 +373,7 @@ TEST_F(HeapTest, Regress978156) { ...@@ -373,8 +373,7 @@ TEST_F(HeapTest, Regress978156) {
Heap* heap = isolate()->heap(); Heap* heap = isolate()->heap();
// 1. Ensure that the new space is empty. // 1. Ensure that the new space is empty.
CollectGarbage(NEW_SPACE); GcAndSweep(OLD_SPACE);
CollectGarbage(NEW_SPACE);
// 2. Fill the new space with FixedArrays. // 2. Fill the new space with FixedArrays.
std::vector<Handle<FixedArray>> arrays; std::vector<Handle<FixedArray>> arrays;
SimulateFullSpace(heap->new_space(), &arrays); SimulateFullSpace(heap->new_space(), &arrays);
......
...@@ -54,8 +54,9 @@ void FillPageInPagedSpace(Page* page, ...@@ -54,8 +54,9 @@ void FillPageInPagedSpace(Page* page,
std::vector<Handle<FixedArray>>* out_handles) { std::vector<Handle<FixedArray>>* out_handles) {
DCHECK(page->SweepingDone()); DCHECK(page->SweepingDone());
PagedSpaceBase* paged_space = static_cast<PagedSpaceBase*>(page->owner()); PagedSpaceBase* paged_space = static_cast<PagedSpaceBase*>(page->owner());
DCHECK_EQ(kNullAddress, paged_space->top()); // Make sure the LAB is empty to guarantee that all free space is accounted
DCHECK(!page->Contains(paged_space->top())); // for in the freelist.
DCHECK_EQ(paged_space->limit(), paged_space->top());
for (Page* p : *paged_space) { for (Page* p : *paged_space) {
if (p != page) paged_space->UnlinkFreeListCategories(p); if (p != page) paged_space->UnlinkFreeListCategories(p);
......
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