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

Side by Side Diff: src/heap.cc

Issue 411293002: re-land: Track history of events in GCTracer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Disable failing SerializeToplevelIsolates test. Created 6 years, 5 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/incremental-marking.h » ('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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/once.h" 9 #include "src/base/once.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 semi_space_copied_object_size_(0), 107 semi_space_copied_object_size_(0),
108 semi_space_copied_rate_(0), 108 semi_space_copied_rate_(0),
109 nodes_died_in_new_space_(0), 109 nodes_died_in_new_space_(0),
110 nodes_copied_in_new_space_(0), 110 nodes_copied_in_new_space_(0),
111 nodes_promoted_(0), 111 nodes_promoted_(0),
112 maximum_size_scavenges_(0), 112 maximum_size_scavenges_(0),
113 max_gc_pause_(0.0), 113 max_gc_pause_(0.0),
114 total_gc_time_ms_(0.0), 114 total_gc_time_ms_(0.0),
115 max_alive_after_gc_(0), 115 max_alive_after_gc_(0),
116 min_in_mutator_(kMaxInt), 116 min_in_mutator_(kMaxInt),
117 alive_after_last_gc_(0),
118 last_gc_end_timestamp_(base::OS::TimeCurrentMillis()),
119 marking_time_(0.0), 117 marking_time_(0.0),
120 sweeping_time_(0.0), 118 sweeping_time_(0.0),
121 mark_compact_collector_(this), 119 mark_compact_collector_(this),
122 store_buffer_(this), 120 store_buffer_(this),
123 marking_(this), 121 marking_(this),
124 incremental_marking_(this), 122 incremental_marking_(this),
125 number_idle_notifications_(0), 123 number_idle_notifications_(0),
126 last_idle_notification_gc_count_(0), 124 last_idle_notification_gc_count_(0),
127 last_idle_notification_gc_count_init_(false), 125 last_idle_notification_gc_count_init_(false),
128 mark_sweeps_since_idle_round_started_(0), 126 mark_sweeps_since_idle_round_started_(0),
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 PrintF("[IncrementalMarking] Delaying MarkSweep.\n"); 833 PrintF("[IncrementalMarking] Delaying MarkSweep.\n");
836 } 834 }
837 collector = SCAVENGER; 835 collector = SCAVENGER;
838 collector_reason = "incremental marking delaying mark-sweep"; 836 collector_reason = "incremental marking delaying mark-sweep";
839 } 837 }
840 } 838 }
841 839
842 bool next_gc_likely_to_collect_more = false; 840 bool next_gc_likely_to_collect_more = false;
843 841
844 { 842 {
845 tracer()->start(collector, gc_reason, collector_reason); 843 tracer()->Start(collector, gc_reason, collector_reason);
846 ASSERT(AllowHeapAllocation::IsAllowed()); 844 ASSERT(AllowHeapAllocation::IsAllowed());
847 DisallowHeapAllocation no_allocation_during_gc; 845 DisallowHeapAllocation no_allocation_during_gc;
848 GarbageCollectionPrologue(); 846 GarbageCollectionPrologue();
849 847
850 { 848 {
851 HistogramTimerScope histogram_timer_scope( 849 HistogramTimerScope histogram_timer_scope(
852 (collector == SCAVENGER) ? isolate_->counters()->gc_scavenger() 850 (collector == SCAVENGER) ? isolate_->counters()->gc_scavenger()
853 : isolate_->counters()->gc_compactor()); 851 : isolate_->counters()->gc_compactor());
854 next_gc_likely_to_collect_more = 852 next_gc_likely_to_collect_more =
855 PerformGarbageCollection(collector, gc_callback_flags); 853 PerformGarbageCollection(collector, gc_callback_flags);
856 } 854 }
857 855
858 GarbageCollectionEpilogue(); 856 GarbageCollectionEpilogue();
859 tracer()->stop(); 857 tracer()->Stop();
860 } 858 }
861 859
862 // Start incremental marking for the next cycle. The heap snapshot 860 // Start incremental marking for the next cycle. The heap snapshot
863 // generator needs incremental marking to stay off after it aborted. 861 // generator needs incremental marking to stay off after it aborted.
864 if (!mark_compact_collector()->abort_incremental_marking() && 862 if (!mark_compact_collector()->abort_incremental_marking() &&
865 incremental_marking()->IsStopped() && 863 incremental_marking()->IsStopped() &&
866 incremental_marking()->WorthActivating() && 864 incremental_marking()->WorthActivating() &&
867 NextGCIsLikelyToBeFull()) { 865 NextGCIsLikelyToBeFull()) {
868 incremental_marking()->Start(); 866 incremental_marking()->Start();
869 } 867 }
(...skipping 5092 matching lines...) Expand 10 before | Expand all | Expand 10 after
5962 OldSpaces spaces(heap); 5960 OldSpaces spaces(heap);
5963 for (OldSpace* space = spaces.next(); 5961 for (OldSpace* space = spaces.next();
5964 space != NULL; 5962 space != NULL;
5965 space = spaces.next()) { 5963 space = spaces.next()) {
5966 holes_size += space->Waste() + space->Available(); 5964 holes_size += space->Waste() + space->Available();
5967 } 5965 }
5968 return holes_size; 5966 return holes_size;
5969 } 5967 }
5970 5968
5971 5969
5972 void Heap::UpdateGCStatistics(double start_time, double end_time, 5970 void Heap::UpdateCumulativeGCStatistics(double duration,
5973 double spent_in_mutator, double marking_time) { 5971 double spent_in_mutator,
5974 double duration = end_time - start_time; 5972 double marking_time) {
5975 alive_after_last_gc_ = SizeOfObjects();
5976 last_gc_end_timestamp_ = end_time;
5977
5978 if (FLAG_print_cumulative_gc_stat) { 5973 if (FLAG_print_cumulative_gc_stat) {
5979 total_gc_time_ms_ += duration; 5974 total_gc_time_ms_ += duration;
5980 max_gc_pause_ = Max(max_gc_pause_, duration); 5975 max_gc_pause_ = Max(max_gc_pause_, duration);
5981 max_alive_after_gc_ = Max(max_alive_after_gc_, alive_after_last_gc_); 5976 max_alive_after_gc_ = Max(max_alive_after_gc_, SizeOfObjects());
5982 min_in_mutator_ = Min(min_in_mutator_, spent_in_mutator); 5977 min_in_mutator_ = Min(min_in_mutator_, spent_in_mutator);
5983 } else if (FLAG_trace_gc_verbose) { 5978 } else if (FLAG_trace_gc_verbose) {
5984 total_gc_time_ms_ += duration; 5979 total_gc_time_ms_ += duration;
5985 } 5980 }
5986 5981
5987 marking_time_ += marking_time; 5982 marking_time_ += marking_time;
5988 } 5983 }
5989 5984
5990 5985
5986 GCTracer::Event::Event(Type type, const char* gc_reason,
5987 const char* collector_reason)
5988 : type(type),
5989 gc_reason(gc_reason),
5990 collector_reason(collector_reason),
5991 start_time(0.0),
5992 end_time(0.0),
5993 start_object_size(0),
5994 end_object_size(0),
5995 start_memory_size(0),
5996 end_memory_size(0),
5997 start_holes_size(0),
5998 end_holes_size(0),
5999 incremental_marking_steps(0),
6000 incremental_marking_duration(0.0) {
6001 for (int i = 0; i < Scope::NUMBER_OF_SCOPES; i++) {
6002 scopes[i] = 0;
6003 }
6004 }
6005
6006
6007 const char* GCTracer::Event::TypeName(bool short_name) const {
6008 switch (type) {
6009 case SCAVENGER:
6010 if (short_name) {
6011 return "s";
6012 } else {
6013 return "Scavenge";
6014 }
6015 case MARK_COMPACTOR:
6016 if (short_name) {
6017 return "ms";
6018 } else {
6019 return "Mark-sweep";
6020 }
6021 case START:
6022 if (short_name) {
6023 return "st";
6024 } else {
6025 return "Start";
6026 }
6027 }
6028 return "Unknown Event Type";
6029 }
6030
6031
5991 GCTracer::GCTracer(Heap* heap) 6032 GCTracer::GCTracer(Heap* heap)
5992 : start_time_(0.0), 6033 : heap_(heap),
5993 end_time_(0.0), 6034 incremental_marking_steps_(0),
5994 start_object_size_(0), 6035 incremental_marking_duration_(0.0),
5995 end_object_size_(0), 6036 longest_incremental_marking_step_(0.0) {
5996 start_memory_size_(0), 6037 current_ = Event(Event::START, NULL, NULL);
5997 end_memory_size_(0), 6038 current_.end_time = base::OS::TimeCurrentMillis();
5998 in_free_list_or_wasted_before_gc_(0), 6039 previous_ = previous_mark_compactor_event_ = current_;
5999 allocated_since_last_gc_(0), 6040 }
6000 spent_in_mutator_(0), 6041
6001 steps_count_(0), 6042
6002 steps_took_(0.0), 6043 void GCTracer::Start(GarbageCollector collector, const char* gc_reason,
6003 longest_step_(0.0), 6044 const char* collector_reason) {
6004 steps_count_since_last_gc_(0), 6045 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
6005 steps_took_since_last_gc_(0.0), 6046
6006 heap_(heap), 6047 previous_ = current_;
6007 gc_reason_(NULL), 6048 if (current_.type == Event::MARK_COMPACTOR)
6008 collector_reason_(NULL) { 6049 previous_mark_compactor_event_ = current_;
6050
6051 if (collector == SCAVENGER) {
6052 current_ = Event(Event::SCAVENGER, gc_reason, collector_reason);
6053 } else {
6054 current_ = Event(Event::MARK_COMPACTOR, gc_reason, collector_reason);
6055 }
6056
6057 current_.start_time = base::OS::TimeCurrentMillis();
6058 current_.start_object_size = heap_->SizeOfObjects();
6059 current_.start_memory_size = heap_->isolate()->memory_allocator()->Size();
6060 current_.start_holes_size = CountTotalHolesSize(heap_);
6061
6062 current_.incremental_marking_steps = incremental_marking_steps_;
6063 current_.incremental_marking_duration = incremental_marking_duration_;
6064 current_.longest_incremental_marking_step = longest_incremental_marking_step_;
6065
6009 for (int i = 0; i < Scope::NUMBER_OF_SCOPES; i++) { 6066 for (int i = 0; i < Scope::NUMBER_OF_SCOPES; i++) {
6010 scopes_[i] = 0; 6067 current_.scopes[i] = 0;
6011 } 6068 }
6012 } 6069 }
6013 6070
6014 6071
6015 void GCTracer::start(GarbageCollector collector, const char* gc_reason, 6072 void GCTracer::Stop() {
6016 const char* collector_reason) {
6017 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; 6073 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
6018 6074
6019 collector_ = collector; 6075 current_.end_time = base::OS::TimeCurrentMillis();
6020 gc_reason_ = gc_reason; 6076 current_.end_object_size = heap_->SizeOfObjects();
6021 collector_reason_ = collector_reason; 6077 current_.end_memory_size = heap_->isolate()->memory_allocator()->Size();
6078 current_.end_holes_size = CountTotalHolesSize(heap_);
6022 6079
6023 start_time_ = base::OS::TimeCurrentMillis(); 6080 if (current_.type == Event::SCAVENGER) {
6024 start_object_size_ = heap_->SizeOfObjects(); 6081 scavenger_events_.push_front(current_);
6025 start_memory_size_ = heap_->isolate()->memory_allocator()->Size(); 6082 } else {
6026 6083 mark_compactor_events_.push_front(current_);
6027 for (int i = 0; i < Scope::NUMBER_OF_SCOPES; i++) {
6028 scopes_[i] = 0;
6029 } 6084 }
6030 6085
6031 in_free_list_or_wasted_before_gc_ = CountTotalHolesSize(heap_); 6086 if (current_.type == Event::MARK_COMPACTOR)
6087 longest_incremental_marking_step_ = 0.0;
6032 6088
6033 allocated_since_last_gc_ = 6089 double duration = current_.end_time - current_.start_time;
6034 heap_->SizeOfObjects() - heap_->alive_after_last_gc_; 6090 double spent_in_mutator = Max(current_.start_time - previous_.end_time, 0.0);
6035 6091
6036 spent_in_mutator_ = Max(start_time_ - heap_->last_gc_end_timestamp_, 0.0); 6092 heap_->UpdateCumulativeGCStatistics(duration, spent_in_mutator,
6093 current_.scopes[Scope::MC_MARK]);
6037 6094
6038 steps_count_ = heap_->incremental_marking()->steps_count(); 6095 if (current_.type == Event::SCAVENGER && FLAG_trace_gc_ignore_scavenger)
6039 steps_took_ = heap_->incremental_marking()->steps_took(); 6096 return;
6040 longest_step_ = heap_->incremental_marking()->longest_step();
6041 steps_count_since_last_gc_ =
6042 heap_->incremental_marking()->steps_count_since_last_gc();
6043 steps_took_since_last_gc_ =
6044 heap_->incremental_marking()->steps_took_since_last_gc();
6045 }
6046
6047
6048 void GCTracer::stop() {
6049 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return;
6050
6051 end_time_ = base::OS::TimeCurrentMillis();
6052 end_object_size_ = heap_->SizeOfObjects();
6053 end_memory_size_ = heap_->isolate()->memory_allocator()->Size();
6054
6055 heap_->UpdateGCStatistics(start_time_, end_time_, spent_in_mutator_,
6056 scopes_[Scope::MC_MARK]);
6057
6058 if (collector_ == SCAVENGER && FLAG_trace_gc_ignore_scavenger) return;
6059 6097
6060 if (FLAG_trace_gc) { 6098 if (FLAG_trace_gc) {
6061 if (FLAG_trace_gc_nvp) 6099 if (FLAG_trace_gc_nvp)
6062 PrintNVP(); 6100 PrintNVP();
6063 else 6101 else
6064 Print(); 6102 Print();
6065 6103
6066 heap_->PrintShortHeapStatistics(); 6104 heap_->PrintShortHeapStatistics();
6067 } 6105 }
6068 } 6106 }
6069 6107
6070 6108
6109 void GCTracer::AddIncrementalMarkingStep(double duration) {
6110 incremental_marking_steps_++;
6111 incremental_marking_duration_ += duration;
6112 longest_incremental_marking_step_ =
6113 Max(longest_incremental_marking_step_, duration);
6114 }
6115
6116
6071 void GCTracer::Print() const { 6117 void GCTracer::Print() const {
6072 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); 6118 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init());
6073 6119
6074 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", CollectorString(), 6120 PrintF("%s %.1f (%.1f) -> %.1f (%.1f) MB, ", current_.TypeName(false),
6075 static_cast<double>(start_object_size_) / MB, 6121 static_cast<double>(current_.start_object_size) / MB,
6076 static_cast<double>(start_memory_size_) / MB, 6122 static_cast<double>(current_.start_memory_size) / MB,
6077 static_cast<double>(end_object_size_) / MB, 6123 static_cast<double>(current_.end_object_size) / MB,
6078 static_cast<double>(end_memory_size_) / MB); 6124 static_cast<double>(current_.end_memory_size) / MB);
6079 6125
6080 int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]); 6126 int external_time = static_cast<int>(current_.scopes[Scope::EXTERNAL]);
6081 if (external_time > 0) PrintF("%d / ", external_time); 6127 if (external_time > 0) PrintF("%d / ", external_time);
6082 6128
6083 PrintF("%.1f ms", end_time_ - start_time_); 6129 double duration = current_.end_time - current_.start_time;
6084 if (steps_count_ > 0) { 6130 PrintF("%.1f ms", duration);
6085 if (collector_ == SCAVENGER) { 6131 if (current_.type == Event::SCAVENGER) {
6132 int steps = current_.incremental_marking_steps -
6133 previous_.incremental_marking_steps;
6134 if (steps > 0) {
6086 PrintF(" (+ %.1f ms in %d steps since last GC)", 6135 PrintF(" (+ %.1f ms in %d steps since last GC)",
6087 steps_took_since_last_gc_, steps_count_since_last_gc_); 6136 current_.incremental_marking_duration -
6088 } else { 6137 previous_.incremental_marking_duration,
6138 steps);
6139 }
6140 } else {
6141 int steps = current_.incremental_marking_steps -
6142 previous_mark_compactor_event_.incremental_marking_steps;
6143 if (steps > 0) {
6089 PrintF( 6144 PrintF(
6090 " (+ %.1f ms in %d steps since start of marking, " 6145 " (+ %.1f ms in %d steps since start of marking, "
6091 "biggest step %.1f ms)", 6146 "biggest step %.1f ms)",
6092 steps_took_, steps_count_, longest_step_); 6147 current_.incremental_marking_duration -
6148 previous_mark_compactor_event_.incremental_marking_duration,
6149 steps, current_.longest_incremental_marking_step);
6093 } 6150 }
6094 } 6151 }
6095 6152
6096 if (gc_reason_ != NULL) { 6153 if (current_.gc_reason != NULL) {
6097 PrintF(" [%s]", gc_reason_); 6154 PrintF(" [%s]", current_.gc_reason);
6098 } 6155 }
6099 6156
6100 if (collector_reason_ != NULL) { 6157 if (current_.collector_reason != NULL) {
6101 PrintF(" [%s]", collector_reason_); 6158 PrintF(" [%s]", current_.collector_reason);
6102 } 6159 }
6103 6160
6104 PrintF(".\n"); 6161 PrintF(".\n");
6105 } 6162 }
6106 6163
6107 6164
6108 void GCTracer::PrintNVP() const { 6165 void GCTracer::PrintNVP() const {
6109 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init()); 6166 PrintPID("%8.0f ms: ", heap_->isolate()->time_millis_since_init());
6110 6167
6111 PrintF("pause=%.1f ", end_time_ - start_time_); 6168 double duration = current_.end_time - current_.start_time;
6112 PrintF("mutator=%.1f ", spent_in_mutator_); 6169 double spent_in_mutator = current_.start_time - previous_.end_time;
6113 PrintF("gc=");
6114 switch (collector_) {
6115 case SCAVENGER:
6116 PrintF("s");
6117 break;
6118 case MARK_COMPACTOR:
6119 PrintF("ms");
6120 break;
6121 default:
6122 UNREACHABLE();
6123 }
6124 PrintF(" ");
6125 6170
6126 PrintF("external=%.1f ", scopes_[Scope::EXTERNAL]); 6171 PrintF("pause=%.1f ", duration);
6127 PrintF("mark=%.1f ", scopes_[Scope::MC_MARK]); 6172 PrintF("mutator=%.1f ", spent_in_mutator);
6128 PrintF("sweep=%.2f ", scopes_[Scope::MC_SWEEP]); 6173 PrintF("gc=%s ", current_.TypeName(true));
6129 PrintF("sweepns=%.2f ", scopes_[Scope::MC_SWEEP_NEWSPACE]); 6174
6130 PrintF("sweepos=%.2f ", scopes_[Scope::MC_SWEEP_OLDSPACE]); 6175 PrintF("external=%.1f ", current_.scopes[Scope::EXTERNAL]);
6131 PrintF("sweepcode=%.2f ", scopes_[Scope::MC_SWEEP_CODE]); 6176 PrintF("mark=%.1f ", current_.scopes[Scope::MC_MARK]);
6132 PrintF("sweepcell=%.2f ", scopes_[Scope::MC_SWEEP_CELL]); 6177 PrintF("sweep=%.2f ", current_.scopes[Scope::MC_SWEEP]);
6133 PrintF("sweepmap=%.2f ", scopes_[Scope::MC_SWEEP_MAP]); 6178 PrintF("sweepns=%.2f ", current_.scopes[Scope::MC_SWEEP_NEWSPACE]);
6134 PrintF("evacuate=%.1f ", scopes_[Scope::MC_EVACUATE_PAGES]); 6179 PrintF("sweepos=%.2f ", current_.scopes[Scope::MC_SWEEP_OLDSPACE]);
6135 PrintF("new_new=%.1f ", scopes_[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS]); 6180 PrintF("sweepcode=%.2f ", current_.scopes[Scope::MC_SWEEP_CODE]);
6136 PrintF("root_new=%.1f ", scopes_[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS]); 6181 PrintF("sweepcell=%.2f ", current_.scopes[Scope::MC_SWEEP_CELL]);
6137 PrintF("old_new=%.1f ", scopes_[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS]); 6182 PrintF("sweepmap=%.2f ", current_.scopes[Scope::MC_SWEEP_MAP]);
6183 PrintF("evacuate=%.1f ", current_.scopes[Scope::MC_EVACUATE_PAGES]);
6184 PrintF("new_new=%.1f ",
6185 current_.scopes[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS]);
6186 PrintF("root_new=%.1f ",
6187 current_.scopes[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS]);
6188 PrintF("old_new=%.1f ",
6189 current_.scopes[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS]);
6138 PrintF("compaction_ptrs=%.1f ", 6190 PrintF("compaction_ptrs=%.1f ",
6139 scopes_[Scope::MC_UPDATE_POINTERS_TO_EVACUATED]); 6191 current_.scopes[Scope::MC_UPDATE_POINTERS_TO_EVACUATED]);
6140 PrintF("intracompaction_ptrs=%.1f ", 6192 PrintF("intracompaction_ptrs=%.1f ",
6141 scopes_[Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED]); 6193 current_.scopes[Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED]);
6142 PrintF("misc_compaction=%.1f ", scopes_[Scope::MC_UPDATE_MISC_POINTERS]); 6194 PrintF("misc_compaction=%.1f ",
6195 current_.scopes[Scope::MC_UPDATE_MISC_POINTERS]);
6143 PrintF("weakcollection_process=%.1f ", 6196 PrintF("weakcollection_process=%.1f ",
6144 scopes_[Scope::MC_WEAKCOLLECTION_PROCESS]); 6197 current_.scopes[Scope::MC_WEAKCOLLECTION_PROCESS]);
6145 PrintF("weakcollection_clear=%.1f ", scopes_[Scope::MC_WEAKCOLLECTION_CLEAR]); 6198 PrintF("weakcollection_clear=%.1f ",
6199 current_.scopes[Scope::MC_WEAKCOLLECTION_CLEAR]);
6146 6200
6147 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_object_size_); 6201 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", current_.start_object_size);
6148 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", end_object_size_); 6202 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", current_.end_object_size);
6149 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", 6203 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", current_.start_holes_size);
6150 in_free_list_or_wasted_before_gc_); 6204 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", current_.end_holes_size);
6151 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize(heap_));
6152 6205
6153 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_); 6206 intptr_t allocated_since_last_gc =
6207 current_.start_object_size - previous_.end_object_size;
6208 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc);
6154 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); 6209 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_);
6155 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", 6210 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ",
6156 heap_->semi_space_copied_object_size_); 6211 heap_->semi_space_copied_object_size_);
6157 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_); 6212 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_);
6158 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_); 6213 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_);
6159 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); 6214 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_);
6160 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); 6215 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_);
6161 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); 6216 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_);
6162 6217
6163 if (collector_ == SCAVENGER) { 6218 if (current_.type == Event::SCAVENGER) {
6164 PrintF("stepscount=%d ", steps_count_since_last_gc_); 6219 PrintF("stepscount=%d ", current_.incremental_marking_steps -
6165 PrintF("stepstook=%.1f ", steps_took_since_last_gc_); 6220 previous_.incremental_marking_steps);
6221 PrintF("stepstook=%.1f ", current_.incremental_marking_duration -
6222 previous_.incremental_marking_duration);
6166 } else { 6223 } else {
6167 PrintF("stepscount=%d ", steps_count_); 6224 PrintF("stepscount=%d ",
6168 PrintF("stepstook=%.1f ", steps_took_); 6225 current_.incremental_marking_steps -
6169 PrintF("longeststep=%.1f ", longest_step_); 6226 previous_mark_compactor_event_.incremental_marking_steps);
6227 PrintF("stepstook=%.1f ",
6228 current_.incremental_marking_duration -
6229 previous_mark_compactor_event_.incremental_marking_duration);
6230 PrintF("longeststep=%.1f ", current_.longest_incremental_marking_step);
6170 } 6231 }
6171 6232
6172 PrintF("\n"); 6233 PrintF("\n");
6173 } 6234 }
6174 6235
6175 6236
6176 const char* GCTracer::CollectorString() const {
6177 switch (collector_) {
6178 case SCAVENGER:
6179 return "Scavenge";
6180 case MARK_COMPACTOR:
6181 return "Mark-sweep";
6182 }
6183 return "Unknown GC";
6184 }
6185
6186
6187 int KeyedLookupCache::Hash(Handle<Map> map, Handle<Name> name) { 6237 int KeyedLookupCache::Hash(Handle<Map> map, Handle<Name> name) {
6188 DisallowHeapAllocation no_gc; 6238 DisallowHeapAllocation no_gc;
6189 // Uses only lower 32 bits if pointers are larger. 6239 // Uses only lower 32 bits if pointers are larger.
6190 uintptr_t addr_hash = 6240 uintptr_t addr_hash =
6191 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(*map)) >> kMapHashShift; 6241 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(*map)) >> kMapHashShift;
6192 return static_cast<uint32_t>((addr_hash ^ name->Hash()) & kCapacityMask); 6242 return static_cast<uint32_t>((addr_hash ^ name->Hash()) & kCapacityMask);
6193 } 6243 }
6194 6244
6195 6245
6196 int KeyedLookupCache::Lookup(Handle<Map> map, Handle<Name> name) { 6246 int KeyedLookupCache::Lookup(Handle<Map> map, Handle<Name> name) {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
6443 static_cast<int>(object_sizes_last_time_[index])); 6493 static_cast<int>(object_sizes_last_time_[index]));
6444 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6494 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6445 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6495 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6446 6496
6447 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6497 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6448 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6498 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6449 ClearObjectStats(); 6499 ClearObjectStats();
6450 } 6500 }
6451 6501
6452 } } // namespace v8::internal 6502 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698