From 59a0641820c8599ec6a6650d7dea1e1424586628 Mon Sep 17 00:00:00 2001 From: mbrandy Date: Thu, 12 Nov 2015 06:33:01 -0800 Subject: [PATCH] Fix test-heap/LargeObjectSlotRecording. Remove hard-coded assumption of large object size threshold. This test fails on PPC in version 4.7 where the threshold is derived directly from the allocator's pagesize. R=hpayer@chromium.org, mstarzinger@chromium.org, michael_dawson@ca.ibm.com BUG= Review URL: https://codereview.chromium.org/1440723002 Cr-Commit-Position: refs/heads/master@{#31963} --- src/heap/spaces.h | 8 ++++---- test/cctest/test-heap.cc | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/heap/spaces.h b/src/heap/spaces.h index 4773e0da47..d326e41fd8 100644 --- a/src/heap/spaces.h +++ b/src/heap/spaces.h @@ -37,7 +37,7 @@ class Isolate; // area. // // There is a separate large object space for objects larger than -// Page::kMaxHeapObjectSize, so that they do not have to move during +// Page::kMaxRegularHeapObjectSize, so that they do not have to move during // collection. The large object space is paged. Pages in large object space // may be larger than the page size. // @@ -2995,9 +2995,9 @@ class MapSpace : public PagedSpace { // ----------------------------------------------------------------------------- -// Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by -// the large object space. A large object is allocated from OS heap with -// extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). +// Large objects ( > Page::kMaxRegularHeapObjectSize ) are allocated and +// managed by the large object space. A large object is allocated from OS +// heap with extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). // A large object always starts at Page::kObjectStartOffset to a page. // Large objects do not move during garbage collections. diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc index b6cd09b5c4..41e6c24b9f 100644 --- a/test/cctest/test-heap.cc +++ b/test/cctest/test-heap.cc @@ -4576,8 +4576,9 @@ TEST(LargeObjectSlotRecording) { FixedArray* old_location = *lit; // Allocate a large object. - const int kSize = 1000000; - Handle lo = isolate->factory()->NewFixedArray(kSize, TENURED); + int size = Max(1000000, Page::kMaxRegularHeapObjectSize + KB); + CHECK(size > Page::kMaxRegularHeapObjectSize); + Handle lo = isolate->factory()->NewFixedArray(size, TENURED); CHECK(heap->lo_space()->Contains(*lo)); // Start incremental marking to active write barrier. @@ -4587,8 +4588,8 @@ TEST(LargeObjectSlotRecording) { // Create references from the large object to the object on the evacuation // candidate. - const int kStep = kSize / 10; - for (int i = 0; i < kSize; i += kStep) { + const int kStep = size / 10; + for (int i = 0; i < size; i += kStep) { lo->set(i, *lit); CHECK(lo->get(i) == old_location); } @@ -4597,7 +4598,7 @@ TEST(LargeObjectSlotRecording) { CcTest::heap()->CollectAllGarbage(); // Verify that the pointers in the large object got updated. - for (int i = 0; i < kSize; i += kStep) { + for (int i = 0; i < size; i += kStep) { CHECK_EQ(lo->get(i), *lit); CHECK(lo->get(i) != old_location); }