Reviewers: Vyacheslav Egorov,

Description:
GC branch:  Some changes to make V8 work with different page sizes.

Please review this at http://codereview.chromium.org/7104136/

SVN Base: http://v8.googlecode.com/svn/branches/experimental/gc/

Affected files:
  M     src/heap.h
  M     src/heap.cc
  M     src/spaces.h
  M     src/spaces.cc


Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 8270)
+++ src/heap.cc (working copy)
@@ -61,8 +61,10 @@
 namespace internal {


-static const intptr_t kMinimumPromotionLimit = 2 * MB;
-static const intptr_t kMinimumAllocationLimit = 8 * MB;
+static const intptr_t kMinimumPromotionLimit =
+    2 * (Page::kPageSize > MB ? Page::kPageSize : MB);
+static const intptr_t kMinimumAllocationLimit =
+    8 * (Page::kPageSize > MB ? Page::kPageSize : MB);


 static Mutex* gc_initializer_mutex = OS::CreateMutex();
@@ -73,27 +75,21 @@
// semispace_size_ should be a power of 2 and old_generation_size_ should be
 // a multiple of Page::kPageSize.
 #if defined(ANDROID)
-      reserved_semispace_size_(2*MB),
-      max_semispace_size_(2*MB),
-      initial_semispace_size_(128*KB),
-      max_old_generation_size_(192*MB),
-      max_executable_size_(max_old_generation_size_),
+#define LUMP_OF_MEMORY (128 * KB)
       code_range_size_(0),
 #elif defined(V8_TARGET_ARCH_X64)
-      reserved_semispace_size_(16*MB),
-      max_semispace_size_(16*MB),
-      initial_semispace_size_(1*MB),
-      max_old_generation_size_(1*GB),
-      max_executable_size_(256*MB),
+#define LUMP_OF_MEMORY (2 * MB)
       code_range_size_(512*MB),
 #else
-      reserved_semispace_size_(4*MB),
-      max_semispace_size_(4*MB),
-      initial_semispace_size_(1*MB),
-      max_old_generation_size_(512*MB),
-      max_executable_size_(128*MB),
+#define LUMP_OF_MEMORY MB
       code_range_size_(0),
 #endif
+      reserved_semispace_size_(4 * Max(LUMP_OF_MEMORY, Page::kPageSize)),
+      max_semispace_size_(4 * Max(LUMP_OF_MEMORY, Page::kPageSize)),
+      initial_semispace_size_(Max(LUMP_OF_MEMORY, Page::kPageSize)),
+      max_old_generation_size_(1024ul * LUMP_OF_MEMORY),
+      max_executable_size_(256l * LUMP_OF_MEMORY),
+
 // Variables set based on semispace_size_ and old_generation_size_ in
// ConfigureHeap (survived_since_last_expansion_, external_allocation_limit_)
 // Will be 4 * reserved_semispace_size_ to ensure that young
Index: src/heap.h
===================================================================
--- src/heap.h  (revision 8267)
+++ src/heap.h  (working copy)
@@ -1338,12 +1338,12 @@
// more expedient to get at the isolate directly from within Heap methods.
   Isolate* isolate_;

+  intptr_t code_range_size_;
   int reserved_semispace_size_;
   int max_semispace_size_;
   int initial_semispace_size_;
   intptr_t max_old_generation_size_;
   intptr_t max_executable_size_;
-  intptr_t code_range_size_;

   // For keeping track of how much data has survived
   // scavenge since last new space expansion.
@@ -1508,8 +1508,6 @@
   bool PerformGarbageCollection(GarbageCollector collector,
                                 GCTracer* tracer);

-  static const intptr_t kMinimumPromotionLimit = 2 * MB;
-  static const intptr_t kMinimumAllocationLimit = 8 * MB;

   inline void UpdateOldSpaceLimits();

Index: src/spaces.cc
===================================================================
--- src/spaces.cc       (revision 8270)
+++ src/spaces.cc       (working copy)
@@ -728,14 +728,6 @@
 }


-void PagedSpace::SetAllocationInfo(Address top, Address limit) {
- Free(allocation_info_.top, allocation_info_.limit - allocation_info_.top);
-  allocation_info_.top = top;
-  allocation_info_.limit = limit;
-  ASSERT(allocation_info_.VerifyPagedAllocation());
-}
-
-
 bool PagedSpace::Expand() {
   ASSERT(max_capacity_ % Page::kObjectAreaSize == 0);
   ASSERT(Capacity() % Page::kObjectAreaSize == 0);
@@ -1057,6 +1049,7 @@
       // Next page should be valid.
       CHECK(!page->is_anchor());
       current = page->body();
+      continue;
     }
     // The allocation pointer should not be in the middle of an object.
     CHECK(!page->ContainsLimit(top()) || current < top());
Index: src/spaces.h
===================================================================
--- src/spaces.h        (revision 8270)
+++ src/spaces.h        (working copy)
@@ -1424,10 +1424,6 @@
   Page* first_unswept_page_;
   Page* last_unswept_page_;

- // Sets allocation pointer. If the allocation pointer already pointed to a
-  // non-zero-length area then that area may be returned to the free list.
-  void SetAllocationInfo(Address start, Address end);
-
// Expands the space by allocating a fixed number of pages. Returns false if
   // it cannot allocate requested number of pages from OS.
   bool Expand();


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to