Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: src/heap.cc

Issue 290133004: Print promotion rate and semi-space copy rate in --trace-gc-nvp. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "api.h" 8 #include "api.h"
9 #include "bootstrapper.h" 9 #include "bootstrapper.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 external_allocation_limit_(0), 90 external_allocation_limit_(0),
91 amount_of_external_allocated_memory_(0), 91 amount_of_external_allocated_memory_(0),
92 amount_of_external_allocated_memory_at_last_global_gc_(0), 92 amount_of_external_allocated_memory_at_last_global_gc_(0),
93 old_gen_exhausted_(false), 93 old_gen_exhausted_(false),
94 inline_allocation_disabled_(false), 94 inline_allocation_disabled_(false),
95 store_buffer_rebuilder_(store_buffer()), 95 store_buffer_rebuilder_(store_buffer()),
96 hidden_string_(NULL), 96 hidden_string_(NULL),
97 gc_safe_size_of_old_object_(NULL), 97 gc_safe_size_of_old_object_(NULL),
98 total_regexp_code_generated_(0), 98 total_regexp_code_generated_(0),
99 tracer_(NULL), 99 tracer_(NULL),
100 young_survivors_after_last_gc_(0),
101 high_survival_rate_period_length_(0), 100 high_survival_rate_period_length_(0),
102 low_survival_rate_period_length_(0), 101 low_survival_rate_period_length_(0),
103 survival_rate_(0), 102 survival_rate_(0),
103 promoted_objects_size_(0),
104 promotion_rate_(0),
105 semi_space_copied_object_size_(0),
106 semi_space_copied_rate_(0),
104 previous_survival_rate_trend_(Heap::STABLE), 107 previous_survival_rate_trend_(Heap::STABLE),
105 survival_rate_trend_(Heap::STABLE), 108 survival_rate_trend_(Heap::STABLE),
106 max_gc_pause_(0.0), 109 max_gc_pause_(0.0),
107 total_gc_time_ms_(0.0), 110 total_gc_time_ms_(0.0),
108 max_alive_after_gc_(0), 111 max_alive_after_gc_(0),
109 min_in_mutator_(kMaxInt), 112 min_in_mutator_(kMaxInt),
110 alive_after_last_gc_(0), 113 alive_after_last_gc_(0),
111 last_gc_end_timestamp_(0.0), 114 last_gc_end_timestamp_(0.0),
112 marking_time_(0.0), 115 marking_time_(0.0),
113 sweeping_time_(0.0), 116 sweeping_time_(0.0),
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 mark_compact_collector()->EnableCodeFlushing(true); 417 mark_compact_collector()->EnableCodeFlushing(true);
415 } 418 }
416 419
417 #ifdef VERIFY_HEAP 420 #ifdef VERIFY_HEAP
418 if (FLAG_verify_heap) { 421 if (FLAG_verify_heap) {
419 Verify(); 422 Verify();
420 } 423 }
421 #endif 424 #endif
422 } 425 }
423 426
427 // Reset GC statistics.
428 promoted_objects_size_ = 0;
429 semi_space_copied_object_size_ = 0;
430
424 UpdateMaximumCommitted(); 431 UpdateMaximumCommitted();
425 432
426 #ifdef DEBUG 433 #ifdef DEBUG
427 ASSERT(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); 434 ASSERT(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC);
428 435
429 if (FLAG_gc_verbose) Print(); 436 if (FLAG_gc_verbose) Print();
430 437
431 ReportStatisticsBeforeGC(); 438 ReportStatisticsBeforeGC();
432 #endif // DEBUG 439 #endif // DEBUG
433 440
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 NormalizedMapCache::cast(cache)->Clear(); 1005 NormalizedMapCache::cast(cache)->Clear();
999 } 1006 }
1000 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); 1007 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK);
1001 } 1008 }
1002 } 1009 }
1003 1010
1004 1011
1005 void Heap::UpdateSurvivalRateTrend(int start_new_space_size) { 1012 void Heap::UpdateSurvivalRateTrend(int start_new_space_size) {
1006 if (start_new_space_size == 0) return; 1013 if (start_new_space_size == 0) return;
1007 1014
1008 double survival_rate = 1015 promotion_rate_ =
1009 (static_cast<double>(young_survivors_after_last_gc_) * 100) / 1016 (static_cast<double>(promoted_objects_size_) /
1010 start_new_space_size; 1017 static_cast<double>(start_new_space_size) * 100);
1018
1019 semi_space_copied_rate_ =
1020 (static_cast<double>(semi_space_copied_object_size_) /
1021 static_cast<double>(start_new_space_size) * 100);
1022
1023 double survival_rate = promotion_rate_ + semi_space_copied_rate_;
1011 1024
1012 if (survival_rate > kYoungSurvivalRateHighThreshold) { 1025 if (survival_rate > kYoungSurvivalRateHighThreshold) {
1013 high_survival_rate_period_length_++; 1026 high_survival_rate_period_length_++;
1014 } else { 1027 } else {
1015 high_survival_rate_period_length_ = 0; 1028 high_survival_rate_period_length_ = 0;
1016 } 1029 }
1017 1030
1018 if (survival_rate < kYoungSurvivalRateLowThreshold) { 1031 if (survival_rate < kYoungSurvivalRateLowThreshold) {
1019 low_survival_rate_period_length_++; 1032 low_survival_rate_period_length_++;
1020 } else { 1033 } else {
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 2062
2050 if (object_contents == POINTER_OBJECT) { 2063 if (object_contents == POINTER_OBJECT) {
2051 if (map->instance_type() == JS_FUNCTION_TYPE) { 2064 if (map->instance_type() == JS_FUNCTION_TYPE) {
2052 heap->promotion_queue()->insert( 2065 heap->promotion_queue()->insert(
2053 target, JSFunction::kNonWeakFieldsEndOffset); 2066 target, JSFunction::kNonWeakFieldsEndOffset);
2054 } else { 2067 } else {
2055 heap->promotion_queue()->insert(target, object_size); 2068 heap->promotion_queue()->insert(target, object_size);
2056 } 2069 }
2057 } 2070 }
2058 2071
2059 heap->tracer()->increment_promoted_objects_size(object_size); 2072 heap->IncrementPromotedObjectsSize(object_size);
2060 return; 2073 return;
2061 } 2074 }
2062 } 2075 }
2063 ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE)); 2076 ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE));
2064 AllocationResult allocation = 2077 AllocationResult allocation =
2065 heap->new_space()->AllocateRaw(allocation_size); 2078 heap->new_space()->AllocateRaw(allocation_size);
2066 heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); 2079 heap->promotion_queue()->SetNewLimit(heap->new_space()->top());
2067 HeapObject* target = HeapObject::cast(allocation.ToObjectChecked()); 2080 HeapObject* target = HeapObject::cast(allocation.ToObjectChecked());
2068 2081
2069 if (alignment != kObjectAlignment) { 2082 if (alignment != kObjectAlignment) {
2070 target = EnsureDoubleAligned(heap, target, allocation_size); 2083 target = EnsureDoubleAligned(heap, target, allocation_size);
2071 } 2084 }
2072 2085
2073 // Order is important: slot might be inside of the target if target 2086 // Order is important: slot might be inside of the target if target
2074 // was allocated over a dead object and slot comes from the store 2087 // was allocated over a dead object and slot comes from the store
2075 // buffer. 2088 // buffer.
2076 *slot = target; 2089 *slot = target;
2077 MigrateObject(heap, object, target, object_size); 2090 MigrateObject(heap, object, target, object_size);
2091 heap->IncrementSemiSpaceCopiedObjectSize(object_size);
2078 return; 2092 return;
2079 } 2093 }
2080 2094
2081 2095
2082 static inline void EvacuateJSFunction(Map* map, 2096 static inline void EvacuateJSFunction(Map* map,
2083 HeapObject** slot, 2097 HeapObject** slot,
2084 HeapObject* object) { 2098 HeapObject* object) {
2085 ObjectEvacuationStrategy<POINTER_OBJECT>:: 2099 ObjectEvacuationStrategy<POINTER_OBJECT>::
2086 template VisitSpecialized<JSFunction::kSize>(map, slot, object); 2100 template VisitSpecialized<JSFunction::kSize>(map, slot, object);
2087 2101
(...skipping 3933 matching lines...) Expand 10 before | Expand all | Expand 10 after
6021 GCTracer::GCTracer(Heap* heap, 6035 GCTracer::GCTracer(Heap* heap,
6022 const char* gc_reason, 6036 const char* gc_reason,
6023 const char* collector_reason) 6037 const char* collector_reason)
6024 : start_time_(0.0), 6038 : start_time_(0.0),
6025 start_object_size_(0), 6039 start_object_size_(0),
6026 start_memory_size_(0), 6040 start_memory_size_(0),
6027 gc_count_(0), 6041 gc_count_(0),
6028 full_gc_count_(0), 6042 full_gc_count_(0),
6029 allocated_since_last_gc_(0), 6043 allocated_since_last_gc_(0),
6030 spent_in_mutator_(0), 6044 spent_in_mutator_(0),
6031 promoted_objects_size_(0),
6032 nodes_died_in_new_space_(0), 6045 nodes_died_in_new_space_(0),
6033 nodes_copied_in_new_space_(0), 6046 nodes_copied_in_new_space_(0),
6034 nodes_promoted_(0), 6047 nodes_promoted_(0),
6035 heap_(heap), 6048 heap_(heap),
6036 gc_reason_(gc_reason), 6049 gc_reason_(gc_reason),
6037 collector_reason_(collector_reason) { 6050 collector_reason_(collector_reason) {
6038 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; 6051 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
6039 start_time_ = OS::TimeCurrentMillis(); 6052 start_time_ = OS::TimeCurrentMillis();
6040 start_object_size_ = heap_->SizeOfObjects(); 6053 start_object_size_ = heap_->SizeOfObjects();
6041 start_memory_size_ = heap_->isolate()->memory_allocator()->Size(); 6054 start_memory_size_ = heap_->isolate()->memory_allocator()->Size();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
6168 PrintF("weakcollection_clear=%.1f ", 6181 PrintF("weakcollection_clear=%.1f ",
6169 scopes_[Scope::MC_WEAKCOLLECTION_CLEAR]); 6182 scopes_[Scope::MC_WEAKCOLLECTION_CLEAR]);
6170 6183
6171 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_object_size_); 6184 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_object_size_);
6172 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", heap_->SizeOfObjects()); 6185 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", heap_->SizeOfObjects());
6173 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", 6186 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ",
6174 in_free_list_or_wasted_before_gc_); 6187 in_free_list_or_wasted_before_gc_);
6175 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize(heap_)); 6188 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize(heap_));
6176 6189
6177 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_); 6190 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_);
6178 PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_); 6191 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_);
6192 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ",
6193 heap_->semi_space_copied_object_size_);
6179 PrintF("nodes_died_in_new=%d ", nodes_died_in_new_space_); 6194 PrintF("nodes_died_in_new=%d ", nodes_died_in_new_space_);
6180 PrintF("nodes_copied_in_new=%d ", nodes_copied_in_new_space_); 6195 PrintF("nodes_copied_in_new=%d ", nodes_copied_in_new_space_);
6181 PrintF("nodes_promoted=%d ", nodes_promoted_); 6196 PrintF("nodes_promoted=%d ", nodes_promoted_);
6182 PrintF("survived=%.1f%% ", heap_->survival_rate_); 6197 PrintF("survival_rate=%.1f%% ", heap_->survival_rate_);
6198 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_);
6199 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_);
6183 6200
6184 if (collector_ == SCAVENGER) { 6201 if (collector_ == SCAVENGER) {
6185 PrintF("stepscount=%d ", steps_count_since_last_gc_); 6202 PrintF("stepscount=%d ", steps_count_since_last_gc_);
6186 PrintF("stepstook=%.1f ", steps_took_since_last_gc_); 6203 PrintF("stepstook=%.1f ", steps_took_since_last_gc_);
6187 } else { 6204 } else {
6188 PrintF("stepscount=%d ", steps_count_); 6205 PrintF("stepscount=%d ", steps_count_);
6189 PrintF("stepstook=%.1f ", steps_took_); 6206 PrintF("stepstook=%.1f ", steps_took_);
6190 PrintF("longeststep=%.1f ", longest_step_); 6207 PrintF("longeststep=%.1f ", longest_step_);
6191 } 6208 }
6192 6209
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
6466 static_cast<int>(object_sizes_last_time_[index])); 6483 static_cast<int>(object_sizes_last_time_[index]));
6467 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6484 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6468 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6485 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6469 6486
6470 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6487 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6471 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6488 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6472 ClearObjectStats(); 6489 ClearObjectStats();
6473 } 6490 }
6474 6491
6475 } } // namespace v8::internal 6492 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698