This patch adds the following three metrics for the --trace_gc_nvp option.
nodes_died_in_new_space_; // Number of died nodes in the new space.
nodes_copied_in_new_space_; // Number of copied nodes to the new space.
nodes_promoted; // Number of promoted nodes to the old space.
BUG=
TEST=Manually confirmed that the "--trace_gc --trace_gc_nvp" option prints the metrics
Review URL: https://codereview.chromium.org/
11365146
Patch from Kentaro Hara <haraken@chromium.org>.
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13159
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
bool GlobalHandles::PostGarbageCollectionProcessing(
- GarbageCollector collector) {
+ GarbageCollector collector, GCTracer* tracer) {
// Process weak global handle callbacks. This must be done after the
// GC is completely done, because the callbacks may invoke arbitrary
// API functions.
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
ASSERT(node->is_in_new_space_list());
- if (node->IsRetainer() && isolate_->heap()->InNewSpace(node->object())) {
- new_space_nodes_[last++] = node;
+ if (node->IsRetainer()) {
+ if (isolate_->heap()->InNewSpace(node->object())) {
+ new_space_nodes_[last++] = node;
+ tracer->increment_nodes_copied_in_new_space();
+ } else {
+ node->set_in_new_space_list(false);
+ tracer->increment_nodes_promoted();
+ }
} else {
node->set_in_new_space_list(false);
+ tracer->increment_nodes_died_in_new_space();
}
}
new_space_nodes_.Rewind(last);
// Process pending weak handles.
// Returns true if next major GC is likely to collect more garbage.
- bool PostGarbageCollectionProcessing(GarbageCollector collector);
+ bool PostGarbageCollectionProcessing(GarbageCollector collector,
+ GCTracer* tracer);
// Iterates over all strong handles.
void IterateStrongRoots(ObjectVisitor* v);
{ DisableAssertNoAllocation allow_allocation;
GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
next_gc_likely_to_collect_more =
- isolate_->global_handles()->PostGarbageCollectionProcessing(collector);
+ isolate_->global_handles()->PostGarbageCollectionProcessing(
+ collector, tracer);
}
gc_post_processing_depth_--;
allocated_since_last_gc_(0),
spent_in_mutator_(0),
promoted_objects_size_(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) {
PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_);
PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_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_);
if (collector_ == SCAVENGER) {
PrintF("stepscount=%d ", steps_count_since_last_gc_);
promoted_objects_size_ += object_size;
}
+ 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();
// Size of objects promoted during the current collection.
intptr_t promoted_objects_size_;
+ // 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_;