Test that we can bootstrap into the first page of each space.
authormstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 20 Sep 2013 12:18:17 +0000 (12:18 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 20 Sep 2013 12:18:17 +0000 (12:18 +0000)
R=olivf@chromium.org
TEST=cctest/test-spaces/SizeOfFirstPageIsLargeEnough

Review URL: https://codereview.chromium.org/24261007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16863 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

test/cctest/test-spaces.cc

index f3f299c..7371065 100644 (file)
@@ -400,3 +400,25 @@ TEST(LargeObjectSpace) {
 
   CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE)->IsFailure());
 }
+
+
+TEST(SizeOfFirstPageIsLargeEnough) {
+  if (i::FLAG_always_opt) return;
+  CcTest::InitializeVM();
+  Isolate* isolate = CcTest::i_isolate();
+
+  // Freshly initialized VM gets by with one page per space.
+  for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) {
+    CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages());
+  }
+
+  // Executing the empty script gets by with one page per space.
+  HandleScope scope(isolate);
+  CompileRun("/*empty*/");
+  for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) {
+    CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages());
+  }
+
+  // No large objects required to perform the above steps.
+  CHECK(isolate->heap()->lo_space()->IsEmpty());
+}