Revision: 22450
Author:   [email protected]
Date:     Thu Jul 17 13:00:46 2014 UTC
Log:      Move node statistics from GCTracer to Heap.

[email protected]
BUG=

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

Modified:
 /branches/bleeding_edge/src/global-handles.cc
 /branches/bleeding_edge/src/global-handles.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h

=======================================
--- /branches/bleeding_edge/src/global-handles.cc Wed Jun 25 09:36:45 2014 UTC +++ /branches/bleeding_edge/src/global-handles.cc Thu Jul 17 13:00:46 2014 UTC
@@ -612,7 +612,7 @@


 int GlobalHandles::PostGarbageCollectionProcessing(
-    GarbageCollector collector, GCTracer* tracer) {
+    GarbageCollector collector) {
   // Process weak global handle callbacks. This must be done after the
   // GC is completely done, because the callbacks may invoke arbitrary
   // API functions.
@@ -675,14 +675,14 @@
     if (node->IsRetainer()) {
       if (isolate_->heap()->InNewSpace(node->object())) {
         new_space_nodes_[last++] = node;
-        tracer->increment_nodes_copied_in_new_space();
+        isolate_->heap()->IncrementNodesCopiedInNewSpace();
       } else {
         node->set_in_new_space_list(false);
-        tracer->increment_nodes_promoted();
+        isolate_->heap()->IncrementNodesPromoted();
       }
     } else {
       node->set_in_new_space_list(false);
-      tracer->increment_nodes_died_in_new_space();
+      isolate_->heap()->IncrementNodesDiedInNewSpace();
     }
   }
   new_space_nodes_.Rewind(last);
=======================================
--- /branches/bleeding_edge/src/global-handles.h Wed Jun 25 09:36:45 2014 UTC +++ /branches/bleeding_edge/src/global-handles.h Thu Jul 17 13:00:46 2014 UTC
@@ -15,7 +15,6 @@
 namespace v8 {
 namespace internal {

-class GCTracer;
 class HeapStats;
 class ObjectVisitor;

@@ -156,8 +155,7 @@

   // Process pending weak handles.
   // Returns the number of freed nodes.
-  int PostGarbageCollectionProcessing(GarbageCollector collector,
-                                      GCTracer* tracer);
+  int PostGarbageCollectionProcessing(GarbageCollector collector);

   // Iterates over all strong handles.
   void IterateStrongRoots(ObjectVisitor* v);
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Jul 17 07:50:55 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Thu Jul 17 13:00:46 2014 UTC
@@ -105,6 +105,9 @@
       promotion_rate_(0),
       semi_space_copied_object_size_(0),
       semi_space_copied_rate_(0),
+      nodes_died_in_new_space_(0),
+      nodes_copied_in_new_space_(0),
+      nodes_promoted_(0),
       maximum_size_scavenges_(0),
       max_gc_pause_(0.0),
       total_gc_time_ms_(0.0),
@@ -428,6 +431,9 @@
   // Reset GC statistics.
   promoted_objects_size_ = 0;
   semi_space_copied_object_size_ = 0;
+  nodes_died_in_new_space_ = 0;
+  nodes_copied_in_new_space_ = 0;
+  nodes_promoted_ = 0;

   UpdateMaximumCommitted();

@@ -1115,8 +1121,7 @@
   { AllowHeapAllocation allow_allocation;
     GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
     freed_global_handles =
-        isolate_->global_handles()->PostGarbageCollectionProcessing(
-            collector, tracer);
+ isolate_->global_handles()->PostGarbageCollectionProcessing(collector);
   }
   gc_post_processing_depth_--;

@@ -5985,9 +5990,6 @@
       collector_(collector),
       allocated_since_last_gc_(0),
       spent_in_mutator_(0),
-      nodes_died_in_new_space_(0),
-      nodes_copied_in_new_space_(0),
-      nodes_promoted_(0),
       heap_(heap),
       gc_reason_(gc_reason),
       collector_reason_(collector_reason) {
@@ -6135,9 +6137,9 @@
   PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_);
   PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ",
          heap_->semi_space_copied_object_size_);
-  PrintF("nodes_died_in_new=%d ", nodes_died_in_new_space_);
-  PrintF("nodes_copied_in_new=%d ", nodes_copied_in_new_space_);
-  PrintF("nodes_promoted=%d ", nodes_promoted_);
+  PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_);
+  PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_);
+  PrintF("nodes_promoted=%d ", heap_->nodes_promoted_);
   PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_);
   PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_);

=======================================
--- /branches/bleeding_edge/src/heap.h  Thu Jul 17 07:50:55 2014 UTC
+++ /branches/bleeding_edge/src/heap.h  Thu Jul 17 13:00:46 2014 UTC
@@ -1181,6 +1181,18 @@
     ASSERT(object_size > 0);
     semi_space_copied_object_size_ += object_size;
   }
+
+  inline void IncrementNodesDiedInNewSpace() {
+    nodes_died_in_new_space_++;
+  }
+
+  inline void IncrementNodesCopiedInNewSpace() {
+    nodes_copied_in_new_space_++;
+  }
+
+  inline void IncrementNodesPromoted() {
+    nodes_promoted_++;
+  }

   inline void IncrementYoungSurvivorsCounter(int survived) {
     ASSERT(survived >= 0);
@@ -2026,6 +2038,9 @@
   double promotion_rate_;
   intptr_t semi_space_copied_object_size_;
   double semi_space_copied_rate_;
+  int nodes_died_in_new_space_;
+  int nodes_copied_in_new_space_;
+  int nodes_promoted_;

   // This is the pretenuring trigger for allocation sites that are in maybe
// tenure state. When we switched to the maximum new space size we deoptimize
@@ -2569,18 +2584,6 @@
                     const char* collector_reason);
   ~GCTracer();

-  void increment_nodes_died_in_new_space() {
-    nodes_died_in_new_space_++;
-  }
-
-  void increment_nodes_copied_in_new_space() {
-    nodes_copied_in_new_space_++;
-  }
-
-  void increment_nodes_promoted() {
-    nodes_promoted_++;
-  }
-
  private:
   // Returns a string matching the collector.
   const char* CollectorString() const;
@@ -2627,15 +2630,6 @@
   // previous collection and the beginning of the current one.
   double spent_in_mutator_;

-  // Number of died nodes in the new space.
-  int nodes_died_in_new_space_;
-
-  // Number of copied nodes to the new space.
-  int nodes_copied_in_new_space_;
-
-  // Number of promoted nodes to the old space.
-  int nodes_promoted_;
-
   // Incremental marking steps counters.
   int steps_count_;
   double steps_took_;

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