Reviewers: Hannes Payer,

Message:
PTAL. Next step is to remove the idle limit.

Description:
Dampen old generation allocation limit after scavenge if allocation rate is low.

BUG=chromium:491907,chromium:499815
LOG=NO

Please review this at https://codereview.chromium.org/1180203003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+28, -5 lines):
  M src/heap/heap.h
  M src/heap/heap.cc


Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index ec48b324479b6bd90b66fd5af7c728f03e5ac804..c8e40b00c5c2cd178f2f2962b9997ac32aeffe7a 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1283,16 +1283,18 @@ bool Heap::PerformGarbageCollection(
   // Update relocatables.
   Relocatable::PostGarbageCollectionProcessing(isolate_);

+ double gc_speed = tracer()->CombinedMarkCompactSpeedInBytesPerMillisecond();
+  double mutator_speed = static_cast<double>(
+      tracer()
+ ->CurrentOldGenerationAllocationThroughputInBytesPerMillisecond());
+  intptr_t old_gen_size = PromotedSpaceSizeOfObjects();
   if (collector == MARK_COMPACTOR) {
     // Register the amount of external allocated memory.
     amount_of_external_allocated_memory_at_last_global_gc_ =
         amount_of_external_allocated_memory_;
- double gc_speed = tracer()->CombinedMarkCompactSpeedInBytesPerMillisecond();
-    double mutator_speed = static_cast<double>(
-        tracer()
- ->CurrentOldGenerationAllocationThroughputInBytesPerMillisecond());
-    intptr_t old_gen_size = PromotedSpaceSizeOfObjects();
     SetOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed);
+  } else if (HasLowYoungGenerationAllocationRate()) {
+ DampenOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed);
   }

   {
@@ -5575,6 +5577,23 @@ void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size,
 }


+void Heap::DampenOldGenerationAllocationLimit(intptr_t old_gen_size,
+                                              double gc_speed,
+                                              double mutator_speed) {
+  double factor = HeapGrowingFactor(gc_speed, mutator_speed);
+ intptr_t limit = CalculateOldGenerationAllocationLimit(factor, old_gen_size);
+  if (limit < old_generation_allocation_limit_) {
+    old_generation_allocation_limit_ = limit;
+    if (FLAG_trace_gc_verbose) {
+      PrintIsolate(isolate_, "Dampen: old size: %" V8_PTR_PREFIX
+ "d KB, new limit: %" V8_PTR_PREFIX "d KB (%.1f)\n", + old_gen_size / KB, old_generation_allocation_limit_ / KB,
+                   factor);
+    }
+  }
+}
+
+
 void Heap::EnableInlineAllocation() {
   if (!inline_allocation_disabled_) return;
   inline_allocation_disabled_ = false;
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index 270feda587be961ae9fde87ac3f50a7d784d7142..5a1a2b8a02c0cc1b4d2de2e30ef28e7186fea717 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -1176,6 +1176,10 @@ class Heap {
   // Sets the allocation limit to trigger the next full garbage collection.
void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double gc_speed,
                                        double mutator_speed);
+  // Decreases the allocation limit if the the allocation rate is low.
+  void DampenOldGenerationAllocationLimit(intptr_t old_gen_size,
+                                          double gc_speed,
+                                          double mutator_speed);

   // Indicates whether inline bump-pointer allocation has been disabled.
   bool inline_allocation_disabled() { return inline_allocation_disabled_; }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to