Commit 8451b97b authored by ernstm@chromium.org's avatar ernstm@chromium.org

Move node statistics from GCTracer to Heap.

R=hpayer@chromium.org
BUG=

Review URL: https://codereview.chromium.org/397953012

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22450 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 43c3390e
......@@ -612,7 +612,7 @@ bool GlobalHandles::IterateObjectGroups(ObjectVisitor* v,
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 @@ int GlobalHandles::PostGarbageCollectionProcessing(
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);
......
......@@ -15,7 +15,6 @@
namespace v8 {
namespace internal {
class GCTracer;
class HeapStats;
class ObjectVisitor;
......@@ -156,8 +155,7 @@ class GlobalHandles {
// 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);
......
......@@ -105,6 +105,9 @@ Heap::Heap()
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 @@ void Heap::GarbageCollectionPrologue() {
// 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 @@ bool Heap::PerformGarbageCollection(
{ 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 @@ GCTracer::GCTracer(Heap* heap,
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 @@ void GCTracer::PrintNVP() const {
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_);
......
......@@ -1182,6 +1182,18 @@ class Heap {
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);
survived_since_last_expansion_ += survived;
......@@ -2026,6 +2038,9 @@ class Heap {
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 @@ class GCTracer BASE_EMBEDDED {
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 @@ class GCTracer BASE_EMBEDDED {
// 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_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment