| Index: test/cctest/heap/test-page-promotion.cc
|
| diff --git a/test/cctest/heap/test-page-promotion.cc b/test/cctest/heap/test-page-promotion.cc
|
| index 23dccd165cf6c690b6f1437b56d7c4d040977af3..17096bc7ca6bf982a6f11cc9c19df679d16a2f93 100644
|
| --- a/test/cctest/heap/test-page-promotion.cc
|
| +++ b/test/cctest/heap/test-page-promotion.cc
|
| @@ -57,23 +57,26 @@ UNINITIALIZED_TEST(PagePromotion_NewToOld) {
|
| heap::SimulateFullSpace(heap->new_space(), &handles);
|
| heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
|
| CHECK_GT(handles.size(), 0u);
|
| - // First object in handle should be on the first page.
|
| - Handle<FixedArray> first_object = handles.front();
|
| - Page* first_page = Page::FromAddress(first_object->address());
|
| + // Last object in handles should definitely be on a page that does not
|
| + // contain the age mark, thus qualifying for moving.
|
| + Handle<FixedArray> last_object = handles.back();
|
| + Page* to_be_promoted_page = Page::FromAddress(last_object->address());
|
| + CHECK(!to_be_promoted_page->Contains(heap->new_space()->age_mark()));
|
| // To perform a sanity check on live bytes we need to mark the heap.
|
| heap::SimulateIncrementalMarking(heap, true);
|
| // Sanity check that the page meets the requirements for promotion.
|
| const int threshold_bytes =
|
| FLAG_page_promotion_threshold * Page::kAllocatableMemory / 100;
|
| - CHECK_GE(MarkingState::Internal(first_page).live_bytes(), threshold_bytes);
|
| + CHECK_GE(MarkingState::Internal(to_be_promoted_page).live_bytes(),
|
| + threshold_bytes);
|
|
|
| // Actual checks: The page is in new space first, but is moved to old space
|
| // during a full GC.
|
| - CHECK(heap->new_space()->ContainsSlow(first_page->address()));
|
| - CHECK(!heap->old_space()->ContainsSlow(first_page->address()));
|
| + CHECK(heap->new_space()->ContainsSlow(to_be_promoted_page->address()));
|
| + CHECK(!heap->old_space()->ContainsSlow(to_be_promoted_page->address()));
|
| heap::GcAndSweep(heap, OLD_SPACE);
|
| - CHECK(!heap->new_space()->ContainsSlow(first_page->address()));
|
| - CHECK(heap->old_space()->ContainsSlow(first_page->address()));
|
| + CHECK(!heap->new_space()->ContainsSlow(to_be_promoted_page->address()));
|
| + CHECK(heap->old_space()->ContainsSlow(to_be_promoted_page->address()));
|
| }
|
| }
|
|
|
| @@ -91,10 +94,11 @@ UNINITIALIZED_TEST(PagePromotion_NewToNew) {
|
| std::vector<Handle<FixedArray>> handles;
|
| heap::SimulateFullSpace(heap->new_space(), &handles);
|
| CHECK_GT(handles.size(), 0u);
|
| - // Last object in handles should definitely be on the last page which does
|
| - // not contain the age mark.
|
| + // Last object in handles should definitely be on a page that does not
|
| + // contain the age mark, thus qualifying for moving.
|
| Handle<FixedArray> last_object = handles.back();
|
| Page* to_be_promoted_page = Page::FromAddress(last_object->address());
|
| + CHECK(!to_be_promoted_page->Contains(heap->new_space()->age_mark()));
|
| CHECK(to_be_promoted_page->Contains(last_object->address()));
|
| CHECK(heap->new_space()->ToSpaceContainsSlow(last_object->address()));
|
| heap::GcAndSweep(heap, OLD_SPACE);
|
| @@ -126,10 +130,11 @@ UNINITIALIZED_TEST(PagePromotion_NewToNewJSArrayBuffer) {
|
| // Simulate a full space, filling the interesting page with live objects.
|
| heap::SimulateFullSpace(heap->new_space(), &handles);
|
| CHECK_GT(handles.size(), 0u);
|
| - // Last object in handles should definitely be on the last page which does
|
| - // not contain the age mark.
|
| + // First object in handles should be on the same page as the allocated
|
| + // JSArrayBuffer.
|
| Handle<FixedArray> first_object = handles.front();
|
| Page* to_be_promoted_page = Page::FromAddress(first_object->address());
|
| + CHECK(!to_be_promoted_page->Contains(heap->new_space()->age_mark()));
|
| CHECK(to_be_promoted_page->Contains(first_object->address()));
|
| CHECK(to_be_promoted_page->Contains(buffer->address()));
|
| CHECK(heap->new_space()->ToSpaceContainsSlow(first_object->address()));
|
| @@ -160,10 +165,11 @@ UNINITIALIZED_HEAP_TEST(Regress658718) {
|
| std::vector<Handle<FixedArray>> handles;
|
| heap::SimulateFullSpace(heap->new_space(), &handles);
|
| CHECK_GT(handles.size(), 0u);
|
| - // Last object in handles should definitely be on the last page which does
|
| - // not contain the age mark.
|
| + // Last object in handles should definitely be on a page that does not
|
| + // contain the age mark, thus qualifying for moving.
|
| Handle<FixedArray> last_object = handles.back();
|
| Page* to_be_promoted_page = Page::FromAddress(last_object->address());
|
| + CHECK(!to_be_promoted_page->Contains(heap->new_space()->age_mark()));
|
| CHECK(to_be_promoted_page->Contains(last_object->address()));
|
| CHECK(heap->new_space()->ToSpaceContainsSlow(last_object->address()));
|
| heap->CollectGarbage(OLD_SPACE, i::GarbageCollectionReason::kTesting);
|
|
|