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

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') | no next file » | 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 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 2049
2050 if (object_contents == POINTER_OBJECT) { 2050 if (object_contents == POINTER_OBJECT) {
2051 if (map->instance_type() == JS_FUNCTION_TYPE) { 2051 if (map->instance_type() == JS_FUNCTION_TYPE) {
2052 heap->promotion_queue()->insert( 2052 heap->promotion_queue()->insert(
2053 target, JSFunction::kNonWeakFieldsEndOffset); 2053 target, JSFunction::kNonWeakFieldsEndOffset);
2054 } else { 2054 } else {
2055 heap->promotion_queue()->insert(target, object_size); 2055 heap->promotion_queue()->insert(target, object_size);
2056 } 2056 }
2057 } 2057 }
2058 2058
2059 heap->tracer()->increment_promoted_objects_size(object_size); 2059 if (FLAG_trace_gc) {
Michael Starzinger 2014/05/16 11:30:37 nit: This makes the code harder to read and I am n
Hannes Payer (out of office) 2014/05/20 09:29:14 Done.
2060 heap->tracer()->increment_promoted_objects_size(object_size);
2061 }
2060 return; 2062 return;
2061 } 2063 }
2062 } 2064 }
2063 ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE)); 2065 ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE));
2064 AllocationResult allocation = 2066 AllocationResult allocation =
2065 heap->new_space()->AllocateRaw(allocation_size); 2067 heap->new_space()->AllocateRaw(allocation_size);
2066 heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); 2068 heap->promotion_queue()->SetNewLimit(heap->new_space()->top());
2067 HeapObject* target = HeapObject::cast(allocation.ToObjectChecked()); 2069 HeapObject* target = HeapObject::cast(allocation.ToObjectChecked());
2068 2070
2069 if (alignment != kObjectAlignment) { 2071 if (alignment != kObjectAlignment) {
2070 target = EnsureDoubleAligned(heap, target, allocation_size); 2072 target = EnsureDoubleAligned(heap, target, allocation_size);
2071 } 2073 }
2072 2074
2073 // Order is important: slot might be inside of the target if target 2075 // 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 2076 // was allocated over a dead object and slot comes from the store
2075 // buffer. 2077 // buffer.
2076 *slot = target; 2078 *slot = target;
2077 MigrateObject(heap, object, target, object_size); 2079 MigrateObject(heap, object, target, object_size);
2080 if (FLAG_trace_gc) {
Michael Starzinger 2014/05/16 11:30:37 nit: Likewise.
Hannes Payer (out of office) 2014/05/20 09:29:14 Done.
2081 heap->tracer()->increment_semi_space_copied_object_size(object_size);
2082 }
2078 return; 2083 return;
2079 } 2084 }
2080 2085
2081 2086
2082 static inline void EvacuateJSFunction(Map* map, 2087 static inline void EvacuateJSFunction(Map* map,
2083 HeapObject** slot, 2088 HeapObject** slot,
2084 HeapObject* object) { 2089 HeapObject* object) {
2085 ObjectEvacuationStrategy<POINTER_OBJECT>:: 2090 ObjectEvacuationStrategy<POINTER_OBJECT>::
2086 template VisitSpecialized<JSFunction::kSize>(map, slot, object); 2091 template VisitSpecialized<JSFunction::kSize>(map, slot, object);
2087 2092
(...skipping 3934 matching lines...) Expand 10 before | Expand all | Expand 10 after
6022 const char* gc_reason, 6027 const char* gc_reason,
6023 const char* collector_reason) 6028 const char* collector_reason)
6024 : start_time_(0.0), 6029 : start_time_(0.0),
6025 start_object_size_(0), 6030 start_object_size_(0),
6026 start_memory_size_(0), 6031 start_memory_size_(0),
6027 gc_count_(0), 6032 gc_count_(0),
6028 full_gc_count_(0), 6033 full_gc_count_(0),
6029 allocated_since_last_gc_(0), 6034 allocated_since_last_gc_(0),
6030 spent_in_mutator_(0), 6035 spent_in_mutator_(0),
6031 promoted_objects_size_(0), 6036 promoted_objects_size_(0),
6037 semi_space_copied_object_size_(0),
6032 nodes_died_in_new_space_(0), 6038 nodes_died_in_new_space_(0),
6033 nodes_copied_in_new_space_(0), 6039 nodes_copied_in_new_space_(0),
6034 nodes_promoted_(0), 6040 nodes_promoted_(0),
6035 heap_(heap), 6041 heap_(heap),
6036 gc_reason_(gc_reason), 6042 gc_reason_(gc_reason),
6037 collector_reason_(collector_reason) { 6043 collector_reason_(collector_reason) {
6038 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; 6044 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
6039 start_time_ = OS::TimeCurrentMillis(); 6045 start_time_ = OS::TimeCurrentMillis();
6040 start_object_size_ = heap_->SizeOfObjects(); 6046 start_object_size_ = heap_->SizeOfObjects();
6041 start_memory_size_ = heap_->isolate()->memory_allocator()->Size(); 6047 start_memory_size_ = heap_->isolate()->memory_allocator()->Size();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
6169 scopes_[Scope::MC_WEAKCOLLECTION_CLEAR]); 6175 scopes_[Scope::MC_WEAKCOLLECTION_CLEAR]);
6170 6176
6171 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_object_size_); 6177 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_object_size_);
6172 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", heap_->SizeOfObjects()); 6178 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", heap_->SizeOfObjects());
6173 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", 6179 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ",
6174 in_free_list_or_wasted_before_gc_); 6180 in_free_list_or_wasted_before_gc_);
6175 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize(heap_)); 6181 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize(heap_));
6176 6182
6177 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_); 6183 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_);
6178 PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_); 6184 PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_);
6185 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ",
6186 semi_space_copied_object_size_);
6179 PrintF("nodes_died_in_new=%d ", nodes_died_in_new_space_); 6187 PrintF("nodes_died_in_new=%d ", nodes_died_in_new_space_);
6180 PrintF("nodes_copied_in_new=%d ", nodes_copied_in_new_space_); 6188 PrintF("nodes_copied_in_new=%d ", nodes_copied_in_new_space_);
6181 PrintF("nodes_promoted=%d ", nodes_promoted_); 6189 PrintF("nodes_promoted=%d ", nodes_promoted_);
6182 PrintF("survived=%.1f%% ", heap_->survival_rate_); 6190 PrintF("survival_rate=%.1f%% ", heap_->survival_rate_);
6191 PrintF("promotion_rate=%.1f%% ",
6192 (static_cast<double>(promoted_objects_size_) /
6193 static_cast<double>(heap_->new_space()->Capacity())) * 100);
6194 PrintF("semi_space_copy_rate=%.1f%% ",
6195 (static_cast<double>(semi_space_copied_object_size_) /
6196 static_cast<double>(heap_->new_space()->Capacity())) * 100);
6183 6197
6184 if (collector_ == SCAVENGER) { 6198 if (collector_ == SCAVENGER) {
6185 PrintF("stepscount=%d ", steps_count_since_last_gc_); 6199 PrintF("stepscount=%d ", steps_count_since_last_gc_);
6186 PrintF("stepstook=%.1f ", steps_took_since_last_gc_); 6200 PrintF("stepstook=%.1f ", steps_took_since_last_gc_);
6187 } else { 6201 } else {
6188 PrintF("stepscount=%d ", steps_count_); 6202 PrintF("stepscount=%d ", steps_count_);
6189 PrintF("stepstook=%.1f ", steps_took_); 6203 PrintF("stepstook=%.1f ", steps_took_);
6190 PrintF("longeststep=%.1f ", longest_step_); 6204 PrintF("longeststep=%.1f ", longest_step_);
6191 } 6205 }
6192 6206
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
6466 static_cast<int>(object_sizes_last_time_[index])); 6480 static_cast<int>(object_sizes_last_time_[index]));
6467 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6481 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6468 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6482 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6469 6483
6470 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6484 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6471 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6485 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6472 ClearObjectStats(); 6486 ClearObjectStats();
6473 } 6487 }
6474 6488
6475 } } // namespace v8::internal 6489 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698