| Index: test/cctest/heap/test-spaces.cc
|
| diff --git a/test/cctest/heap/test-spaces.cc b/test/cctest/heap/test-spaces.cc
|
| index 2328518f2a68cd0a9bed0cef3ab8277a8e179892..29bc71a3d85bf447be3dc25b5c1f71de42c1c732 100644
|
| --- a/test/cctest/heap/test-spaces.cc
|
| +++ b/test/cctest/heap/test-spaces.cc
|
| @@ -478,8 +478,7 @@ TEST(LargeObjectSpace) {
|
| CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE).IsRetry());
|
| }
|
|
|
| -
|
| -TEST(SizeOfFirstPageIsLargeEnough) {
|
| +TEST(SizeOfInitialHeap) {
|
| if (i::FLAG_always_opt) return;
|
| // Bootstrapping without a snapshot causes more allocations.
|
| CcTest::InitializeVM();
|
| @@ -495,22 +494,31 @@ TEST(SizeOfFirstPageIsLargeEnough) {
|
| return;
|
| }
|
|
|
| - // If this test fails due to enabling experimental natives that are not part
|
| - // of the snapshot, we may need to adjust CalculateFirstPageSizes.
|
| + // The limit for each space for an empty isolate containing just the
|
| + // snapshot.
|
| + const size_t kMaxInitialSizePerSpace = 1536 * KB; // 1.5MB
|
|
|
| - // Freshly initialized VM gets by with one page per space.
|
| + // Freshly initialized VM gets by with the snapshot size (which is below
|
| + // kMaxInitialSizePerSpace per space).
|
| + Heap* heap = isolate->heap();
|
| + int page_count[LAST_PAGED_SPACE + 1] = {0, 0, 0, 0};
|
| for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) {
|
| // Debug code can be very large, so skip CODE_SPACE if we are generating it.
|
| if (i == CODE_SPACE && i::FLAG_debug_code) continue;
|
| - CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages());
|
| +
|
| + page_count[i] = heap->paged_space(i)->CountTotalPages();
|
| + // Check that the initial heap is also below the limit.
|
| + CHECK_LT(static_cast<size_t>(heap->paged_space(i)->CommittedMemory()),
|
| + kMaxInitialSizePerSpace);
|
| }
|
|
|
| - // Executing the empty script gets by with one page per space.
|
| + // Executing the empty script gets by with the same number of pages, i.e.,
|
| + // requires no extra space.
|
| CompileRun("/*empty*/");
|
| for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) {
|
| // Debug code can be very large, so skip CODE_SPACE if we are generating it.
|
| if (i == CODE_SPACE && i::FLAG_debug_code) continue;
|
| - CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages());
|
| + CHECK_EQ(page_count[i], isolate->heap()->paged_space(i)->CountTotalPages());
|
| }
|
|
|
| // No large objects required to perform the above steps.
|
|
|