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