Revision: 22647
Author:   [email protected]
Date:     Mon Jul 28 14:18:40 2014 UTC
Log: Removed IdleGlobalGC and just perform IdleNotification when incremental marking is on.

BUG=397026
LOG=n
[email protected]

Review URL: https://codereview.chromium.org/422013002
http://code.google.com/p/v8/source/detail?r=22647

Modified:
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h

=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Jul 28 12:32:55 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Mon Jul 28 14:18:40 2014 UTC
@@ -4250,6 +4250,9 @@


 bool Heap::IdleNotification(int hint) {
+  // If incremental marking is off, we do not perform idle notification.
+  if (!FLAG_incremental_marking) return true;
+
   // Hints greater than this value indicate that
   // the embedder is requesting a lot of GC work.
   const int kMaxHint = 1000;
@@ -4285,10 +4288,6 @@
     StartIdleRound();
     return false;
   }
-
-  if (!FLAG_incremental_marking || isolate_->serializer_enabled()) {
-    return IdleGlobalGC();
-  }

   // By doing small chunks of GC work in each IdleNotification,
   // perform a round of incremental GCs and after that wait until
@@ -4342,66 +4341,6 @@

   return false;
 }
-
-
-bool Heap::IdleGlobalGC() {
-  static const int kIdlesBeforeScavenge = 4;
-  static const int kIdlesBeforeMarkSweep = 7;
-  static const int kIdlesBeforeMarkCompact = 8;
-  static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1;
-  static const unsigned int kGCsBetweenCleanup = 4;
-
-  if (!last_idle_notification_gc_count_init_) {
-    last_idle_notification_gc_count_ = gc_count_;
-    last_idle_notification_gc_count_init_ = true;
-  }
-
-  bool uncommit = true;
-  bool finished = false;
-
-  // Reset the number of idle notifications received when a number of
-  // GCs have taken place. This allows another round of cleanup based
-  // on idle notifications if enough work has been carried out to
-  // provoke a number of garbage collections.
-  if (gc_count_ - last_idle_notification_gc_count_ < kGCsBetweenCleanup) {
-    number_idle_notifications_ =
-        Min(number_idle_notifications_ + 1, kMaxIdleCount);
-  } else {
-    number_idle_notifications_ = 0;
-    last_idle_notification_gc_count_ = gc_count_;
-  }
-
-  if (number_idle_notifications_ == kIdlesBeforeScavenge) {
-    CollectGarbage(NEW_SPACE, "idle notification");
-    new_space_.Shrink();
-    last_idle_notification_gc_count_ = gc_count_;
-  } else if (number_idle_notifications_ == kIdlesBeforeMarkSweep) {
-    // Before doing the mark-sweep collections we clear the
-    // compilation cache to avoid hanging on to source code and
-    // generated code for cached functions.
-    isolate_->compilation_cache()->Clear();
-
-    CollectAllGarbage(kReduceMemoryFootprintMask, "idle notification");
-    new_space_.Shrink();
-    last_idle_notification_gc_count_ = gc_count_;
-
-  } else if (number_idle_notifications_ == kIdlesBeforeMarkCompact) {
-    CollectAllGarbage(kReduceMemoryFootprintMask, "idle notification");
-    new_space_.Shrink();
-    last_idle_notification_gc_count_ = gc_count_;
-    number_idle_notifications_ = 0;
-    finished = true;
-  } else if (number_idle_notifications_ > kIdlesBeforeMarkCompact) {
-    // If we have received more than kIdlesBeforeMarkCompact idle
-    // notifications we do not perform any cleanup because we don't
-    // expect to gain much by doing so.
-    finished = true;
-  }
-
-  if (uncommit) UncommitFromSpace();
-
-  return finished;
-}


 #ifdef DEBUG
=======================================
--- /branches/bleeding_edge/src/heap.h  Thu Jul 24 13:06:38 2014 UTC
+++ /branches/bleeding_edge/src/heap.h  Mon Jul 28 14:18:40 2014 UTC
@@ -2077,9 +2077,6 @@
     int heap_size_mb = static_cast<int>(SizeOfObjects() / MB);
     return heap_size_mb / kMbPerMs;
   }
-
-  // Returns true if no more GC work is left.
-  bool IdleGlobalGC();

   void AdvanceIdleIncrementalMarking(intptr_t step_size);

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