Reviewers: Michael Starzinger,

Message:
Please take a look.

Description:
Unify promotion and allocation limit computation.

BUG=129628
[email protected]

Please review this at https://chromiumcodereview.appspot.com/10552002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/heap.h
  M src/heap.cc
  M src/mark-compact.cc


Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 1e5e908744974f72ff157776710e2cd526bf895b..914e21aa9c667fa7c4adbb5441534ee67716405a 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -118,8 +118,8 @@ Heap::Heap()
       debug_utils_(NULL),
 #endif  // DEBUG
       new_space_high_promotion_mode_active_(false),
-      old_gen_promotion_limit_(kMinimumPromotionLimit),
-      old_gen_allocation_limit_(kMinimumAllocationLimit),
+      old_gen_promotion_limit_(kMinPromotionLimit),
+      old_gen_allocation_limit_(kMinAllocationLimit),
       old_gen_limit_factor_(1),
       size_of_old_gen_at_last_old_space_gc_(0),
       external_allocation_limit_(0),
@@ -829,9 +829,9 @@ bool Heap::PerformGarbageCollection(GarbageCollector collector,
     }

     old_gen_promotion_limit_ =
-        OldGenPromotionLimit(size_of_old_gen_at_last_old_space_gc_);
+ OldGenLimit(size_of_old_gen_at_last_old_space_gc_, kMinPromotionLimit);
     old_gen_allocation_limit_ =
-        OldGenAllocationLimit(size_of_old_gen_at_last_old_space_gc_);
+ OldGenLimit(size_of_old_gen_at_last_old_space_gc_, kMinAllocationLimit);

     old_gen_exhausted_ = false;
   } else {
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index dd1f710b25224a9521636d12cb221871a39e4f59..93978ead5c95e689470703bf746e3af9ab0ec6d2 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -1359,24 +1359,13 @@ class Heap {
     return max_old_generation_size_ - PromotedTotalSize();
   }

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

-  intptr_t OldGenPromotionLimit(intptr_t old_gen_size) {
-    const int divisor = FLAG_stress_compaction ? 10 : 3;
-    intptr_t limit =
-        Max(old_gen_size + old_gen_size / divisor, kMinimumPromotionLimit);
-    limit += new_space_.Capacity();
-    limit *= old_gen_limit_factor_;
- intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2;
-    return Min(limit, halfway_to_the_max);
-  }
-
-  intptr_t OldGenAllocationLimit(intptr_t old_gen_size) {
+  intptr_t OldGenLimit(intptr_t old_gen_size, intptr_t min_limit) {
     const int divisor = FLAG_stress_compaction ? 8 : 2;
-    intptr_t limit =
- Max(old_gen_size + old_gen_size / divisor, kMinimumAllocationLimit);
+    intptr_t limit = Max(old_gen_size + old_gen_size / divisor, min_limit);
     limit += new_space_.Capacity();
     limit *= old_gen_limit_factor_;
intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2;
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 2aac8b0dd01ed23c7f95363b33678849067d6191..27f48d3a662158f4d0679d83b00144812332a659 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -3817,8 +3817,9 @@ void MarkCompactCollector::SweepSpace(PagedSpace* space, SweeperType sweeper) {

   intptr_t old_space_size = heap()->PromotedSpaceSizeOfObjects();
   intptr_t space_left =
-      Min(heap()->OldGenPromotionLimit(old_space_size),
-          heap()->OldGenAllocationLimit(old_space_size)) - old_space_size;
+      Min(heap()->OldGenLimit(old_space_size, Heap::kMinPromotionLimit),
+          heap()->OldGenLimit(old_space_size, Heap::kMinAllocationLimit)) -
+      old_space_size;

   while (it.has_next()) {
     Page* p = it.next();


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

Reply via email to