Reviewers: jochen,

Message:
PTAL


https://codereview.chromium.org/662543008/diff/1/src/heap/heap.cc
File src/heap/heap.cc (right):

https://codereview.chromium.org/662543008/diff/1/src/heap/heap.cc#newcode4402
src/heap/heap.cc:4402: CollectAllGarbage(kReduceMemoryFootprintMask,
First version didn't have this branch and unconditionally called
IdleMarkCompact, but that regressed sunspider.

Description:
Shrink new space in idle notification.

BUG=chromium:424423
LOG=Y

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

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

Affected files (+30, -19 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 2349f2fa4fe3a013e3510aba3f85a4f4d2a6a4a8..38e4971f4aa55933194c8a4053f3b07a9185d438 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1570,6 +1570,8 @@ void Heap::Scavenge() {
   LOG(isolate_, ResourceEvent("scavenge", "end"));

   gc_state_ = NOT_IN_GC;
+
+  gc_idle_time_handler_.NotifyScavenge();
 }


@@ -4301,6 +4303,23 @@ void Heap::MakeHeapIterable() {
 }


+void Heap::IdleMarkCompact(const char* message) {
+  bool uncommit = false;
+  if (gc_count_at_last_idle_gc_ == gc_count_) {
+    // No GC since the last full GC, the mutator is probably not active.
+    isolate_->compilation_cache()->Clear();
+    uncommit = true;
+  }
+  CollectAllGarbage(kReduceMemoryFootprintMask, message);
+  gc_idle_time_handler_.NotifyIdleMarkCompact();
+  gc_count_at_last_idle_gc_ = gc_count_;
+  if (uncommit) {
+    new_space_.Shrink();
+    UncommitFromSpace();
+  }
+}
+
+
 void Heap::TryFinalizeIdleIncrementalMarking(
     size_t idle_time_in_ms, size_t size_of_objects,
     size_t mark_compact_speed_in_bytes_per_ms) {
@@ -4309,20 +4328,7 @@ void Heap::TryFinalizeIdleIncrementalMarking(
        gc_idle_time_handler_.ShouldDoMarkCompact(
            idle_time_in_ms, size_of_objects,
            mark_compact_speed_in_bytes_per_ms))) {
-    bool uncommit = false;
-    if (gc_count_at_last_idle_gc_ == gc_count_) {
-      // No GC since the last full GC, the mutator is probably not active.
-      isolate_->compilation_cache()->Clear();
-      uncommit = true;
-    }
-    CollectAllGarbage(kReduceMemoryFootprintMask,
-                      "idle notification: finalize incremental");
-    gc_idle_time_handler_.NotifyIdleMarkCompact();
-    gc_count_at_last_idle_gc_ = gc_count_;
-    if (uncommit) {
-      new_space_.Shrink();
-      UncommitFromSpace();
-    }
+    IdleMarkCompact("idle notification: finalize incremental");
   }
 }

@@ -4392,11 +4398,14 @@ bool Heap::IdleNotification(int idle_time_in_ms) {
     }
     case DO_FULL_GC: {
       HistogramTimerScope scope(isolate_->counters()->gc_context());
-      const char* message = contexts_disposed_
-                                ? "idle notification: contexts disposed"
-                                : "idle notification: finalize idle round";
-      CollectAllGarbage(kReduceMemoryFootprintMask, message);
-      gc_idle_time_handler_.NotifyIdleMarkCompact();
+      if (contexts_disposed_) {
+        CollectAllGarbage(kReduceMemoryFootprintMask,
+                          "idle notification: contexts disposed");
+        gc_idle_time_handler_.NotifyIdleMarkCompact();
+        gc_count_at_last_idle_gc_ = gc_count_;
+      } else {
+        IdleMarkCompact("idle notification: finalize idle round");
+      }
       break;
     }
     case DO_SCAVENGE:
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index c0848c926f13b1e9d6f9e341c4e28fe8d2a2c4e7..f3830dd18bdc55bd04423728947b82f7d521085a 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -1975,6 +1975,8 @@ class Heap {

   void SelectScavengingVisitorsTable();

+  void IdleMarkCompact(const char* message);
+
   void TryFinalizeIdleIncrementalMarking(
       size_t idle_time_in_ms, size_t size_of_objects,
       size_t mark_compact_speed_in_bytes_per_ms);


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