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

Side by Side Diff: src/heap.cc

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