Reviewers: ulan,

Description:
Only shrink new space when we are not in the process of obtaining pretenuring
feedback.

BUG=

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

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

Affected files (+11, -8 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 361b4d91d7ffbdbf128fb05f6dde00e27f84e0a7..e1d01f5423b821427d2fc5e0b3cb3c61f4ca8344 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -530,7 +530,8 @@ void Heap::RepairFreeListsAfterDeserialization() {
 }


-void Heap::ProcessPretenuringFeedback() {
+bool Heap::ProcessPretenuringFeedback() {
+  bool trigger_deoptimization = false;
   if (FLAG_allocation_site_pretenuring) {
     int tenure_decisions = 0;
     int dont_tenure_decisions = 0;
@@ -551,7 +552,6 @@ void Heap::ProcessPretenuringFeedback() {

     int i = 0;
     Object* list_element = allocation_sites_list();
-    bool trigger_deoptimization = false;
     bool maximum_size_scavenge = MaximumSizeScavenge();
     while (use_scratchpad ? i < allocation_sites_scratchpad_length_
                           : list_element->IsAllocationSite()) {
@@ -603,6 +603,7 @@ void Heap::ProcessPretenuringFeedback() {
           dont_tenure_decisions);
     }
   }
+  return trigger_deoptimization;
 }


@@ -632,9 +633,6 @@ void Heap::GarbageCollectionEpilogue() {
     ZapFromSpace();
   }

-  // Process pretenuring feedback and update allocation sites.
-  ProcessPretenuringFeedback();
-
 #ifdef VERIFY_HEAP
   if (FLAG_verify_heap) {
     Verify();
@@ -1250,9 +1248,14 @@ bool Heap::PerformGarbageCollection(
     Scavenge();
   }

-
+  bool deopted = ProcessPretenuringFeedback();
   UpdateSurvivalStatistics(start_new_space_size);
-  ConfigureNewGenerationSize();
+
+ // When pretenuring is collecting new feedback, we do not shrink the new space
+  // right away.
+  if (!deopted) {
+    ConfigureNewGenerationSize();
+  }
   ConfigureInitialOldGenerationSize();

   isolate_->counters()->objs_since_last_young()->Set(0);
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index a580695eb471af82992d3fea81f9127528d11bde..ac4d3b37baa6e2aa225edefa4f266e8ff25321e3 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -1862,7 +1862,7 @@ class Heap {
// space evacuation. Note that between feedback collection and calling this
   // method object in old space must not move.
   // Right now we only process pretenuring feedback in high promotion mode.
-  void ProcessPretenuringFeedback();
+  bool ProcessPretenuringFeedback();

   // Checks whether a global GC is necessary
   GarbageCollector SelectGarbageCollector(AllocationSpace space,


--
--
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