Initially unmap one of the semispaces to reduce memory use at boot time.
authorerik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 24 Jan 2012 16:00:19 +0000 (16:00 +0000)
committererik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 24 Jan 2012 16:00:19 +0000 (16:00 +0000)
Review URL: https://chromiumcodereview.appspot.com/9117035

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

src/spaces.cc
src/spaces.h
test/cctest/test-mark-compact.cc

index d5b4d81..05c5876 100644 (file)
@@ -922,14 +922,13 @@ bool NewSpace::SetUp(int reserved_semispace_capacity,
          2 * heap()->ReservedSemiSpaceSize());
   ASSERT(IsAddressAligned(chunk_base_, 2 * reserved_semispace_capacity, 0));
 
-  if (!to_space_.SetUp(chunk_base_,
-                       initial_semispace_capacity,
-                       maximum_semispace_capacity)) {
-    return false;
-  }
-  if (!from_space_.SetUp(chunk_base_ + reserved_semispace_capacity,
-                         initial_semispace_capacity,
-                         maximum_semispace_capacity)) {
+  to_space_.SetUp(chunk_base_,
+                  initial_semispace_capacity,
+                  maximum_semispace_capacity);
+  from_space_.SetUp(chunk_base_ + reserved_semispace_capacity,
+                    initial_semispace_capacity,
+                    maximum_semispace_capacity);
+  if (!to_space_.Commit()) {
     return false;
   }
 
@@ -1162,7 +1161,7 @@ void NewSpace::Verify() {
 // -----------------------------------------------------------------------------
 // SemiSpace implementation
 
-bool SemiSpace::SetUp(Address start,
+void SemiSpace::SetUp(Address start,
                       int initial_capacity,
                       int maximum_capacity) {
   // Creates a space in the young generation. The constructor does not
@@ -1181,8 +1180,6 @@ bool SemiSpace::SetUp(Address start,
   object_mask_ = address_mask_ | kHeapObjectTagMask;
   object_expected_ = reinterpret_cast<uintptr_t>(start) | kHeapObjectTag;
   age_mark_ = start_;
-
-  return Commit();
 }
 
 
@@ -1232,6 +1229,9 @@ bool SemiSpace::Uncommit() {
 
 
 bool SemiSpace::GrowTo(int new_capacity) {
+  if (!is_committed()) {
+    if (!Commit()) return false;
+  }
   ASSERT((new_capacity & Page::kPageAlignmentMask) == 0);
   ASSERT(new_capacity <= maximum_capacity_);
   ASSERT(new_capacity > capacity_);
index f49873a..1a30078 100644 (file)
@@ -1834,7 +1834,7 @@ class SemiSpace : public Space {
       current_page_(NULL) { }
 
   // Sets up the semispace using the given chunk.
-  bool SetUp(Address start, int initial_capacity, int maximum_capacity);
+  void SetUp(Address start, int initial_capacity, int maximum_capacity);
 
   // Tear down the space.  Heap memory was not allocated by the space, so it
   // is not deallocated here.
index 0929cd4..614b1fd 100644 (file)
@@ -534,15 +534,15 @@ TEST(BootUpMemoryUse) {
     intptr_t booted_memory = MemoryInUse();
     if (sizeof(initial_memory) == 8) {
       if (v8::internal::Snapshot::IsEnabled()) {
-        CHECK_LE(booted_memory - initial_memory, 7654 * 1024);  // 7468.
+        CHECK_LE(booted_memory - initial_memory, 6654 * 1024);  // 6444.
       } else {
-        CHECK_LE(booted_memory - initial_memory, 7777 * 1024);  // 7620.
+        CHECK_LE(booted_memory - initial_memory, 6777 * 1024);  // 6596.
       }
     } else {
       if (v8::internal::Snapshot::IsEnabled()) {
-        CHECK_LE(booted_memory - initial_memory, 7500 * 1024);  // 7380.
+        CHECK_LE(booted_memory - initial_memory, 6500 * 1024);  // 6365.
       } else {
-        CHECK_LE(booted_memory - initial_memory, 7654 * 1024);  // 7448
+        CHECK_LE(booted_memory - initial_memory, 6654 * 1024);  // 6424
       }
     }
   }