| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 store_buffer_rebuilder_(store_buffer()), | 98 store_buffer_rebuilder_(store_buffer()), |
| 99 hidden_string_(NULL), | 99 hidden_string_(NULL), |
| 100 gc_safe_size_of_old_object_(NULL), | 100 gc_safe_size_of_old_object_(NULL), |
| 101 total_regexp_code_generated_(0), | 101 total_regexp_code_generated_(0), |
| 102 tracer_(NULL), | 102 tracer_(NULL), |
| 103 high_survival_rate_period_length_(0), | 103 high_survival_rate_period_length_(0), |
| 104 promoted_objects_size_(0), | 104 promoted_objects_size_(0), |
| 105 promotion_rate_(0), | 105 promotion_rate_(0), |
| 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), |
| 109 nodes_copied_in_new_space_(0), |
| 110 nodes_promoted_(0), |
| 108 maximum_size_scavenges_(0), | 111 maximum_size_scavenges_(0), |
| 109 max_gc_pause_(0.0), | 112 max_gc_pause_(0.0), |
| 110 total_gc_time_ms_(0.0), | 113 total_gc_time_ms_(0.0), |
| 111 max_alive_after_gc_(0), | 114 max_alive_after_gc_(0), |
| 112 min_in_mutator_(kMaxInt), | 115 min_in_mutator_(kMaxInt), |
| 113 alive_after_last_gc_(0), | 116 alive_after_last_gc_(0), |
| 114 last_gc_end_timestamp_(0.0), | 117 last_gc_end_timestamp_(0.0), |
| 115 marking_time_(0.0), | 118 marking_time_(0.0), |
| 116 sweeping_time_(0.0), | 119 sweeping_time_(0.0), |
| 117 mark_compact_collector_(this), | 120 mark_compact_collector_(this), |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 #ifdef VERIFY_HEAP | 424 #ifdef VERIFY_HEAP |
| 422 if (FLAG_verify_heap) { | 425 if (FLAG_verify_heap) { |
| 423 Verify(); | 426 Verify(); |
| 424 } | 427 } |
| 425 #endif | 428 #endif |
| 426 } | 429 } |
| 427 | 430 |
| 428 // Reset GC statistics. | 431 // Reset GC statistics. |
| 429 promoted_objects_size_ = 0; | 432 promoted_objects_size_ = 0; |
| 430 semi_space_copied_object_size_ = 0; | 433 semi_space_copied_object_size_ = 0; |
| 434 nodes_died_in_new_space_ = 0; |
| 435 nodes_copied_in_new_space_ = 0; |
| 436 nodes_promoted_ = 0; |
| 431 | 437 |
| 432 UpdateMaximumCommitted(); | 438 UpdateMaximumCommitted(); |
| 433 | 439 |
| 434 #ifdef DEBUG | 440 #ifdef DEBUG |
| 435 ASSERT(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); | 441 ASSERT(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC); |
| 436 | 442 |
| 437 if (FLAG_gc_verbose) Print(); | 443 if (FLAG_gc_verbose) Print(); |
| 438 | 444 |
| 439 ReportStatisticsBeforeGC(); | 445 ReportStatisticsBeforeGC(); |
| 440 #endif // DEBUG | 446 #endif // DEBUG |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 isolate_->counters()->objs_since_last_young()->Set(0); | 1114 isolate_->counters()->objs_since_last_young()->Set(0); |
| 1109 | 1115 |
| 1110 // Callbacks that fire after this point might trigger nested GCs and | 1116 // Callbacks that fire after this point might trigger nested GCs and |
| 1111 // restart incremental marking, the assertion can't be moved down. | 1117 // restart incremental marking, the assertion can't be moved down. |
| 1112 ASSERT(collector == SCAVENGER || incremental_marking()->IsStopped()); | 1118 ASSERT(collector == SCAVENGER || incremental_marking()->IsStopped()); |
| 1113 | 1119 |
| 1114 gc_post_processing_depth_++; | 1120 gc_post_processing_depth_++; |
| 1115 { AllowHeapAllocation allow_allocation; | 1121 { AllowHeapAllocation allow_allocation; |
| 1116 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); | 1122 GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL); |
| 1117 freed_global_handles = | 1123 freed_global_handles = |
| 1118 isolate_->global_handles()->PostGarbageCollectionProcessing( | 1124 isolate_->global_handles()->PostGarbageCollectionProcessing(collector); |
| 1119 collector, tracer); | |
| 1120 } | 1125 } |
| 1121 gc_post_processing_depth_--; | 1126 gc_post_processing_depth_--; |
| 1122 | 1127 |
| 1123 isolate_->eternal_handles()->PostGarbageCollectionProcessing(this); | 1128 isolate_->eternal_handles()->PostGarbageCollectionProcessing(this); |
| 1124 | 1129 |
| 1125 // Update relocatables. | 1130 // Update relocatables. |
| 1126 Relocatable::PostGarbageCollectionProcessing(isolate_); | 1131 Relocatable::PostGarbageCollectionProcessing(isolate_); |
| 1127 | 1132 |
| 1128 if (collector == MARK_COMPACTOR) { | 1133 if (collector == MARK_COMPACTOR) { |
| 1129 // Register the amount of external allocated memory. | 1134 // Register the amount of external allocated memory. |
| (...skipping 4848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5978 const char* collector_reason) | 5983 const char* collector_reason) |
| 5979 : start_time_(0.0), | 5984 : start_time_(0.0), |
| 5980 end_time_(0.0), | 5985 end_time_(0.0), |
| 5981 start_object_size_(0), | 5986 start_object_size_(0), |
| 5982 end_object_size_(0), | 5987 end_object_size_(0), |
| 5983 start_memory_size_(0), | 5988 start_memory_size_(0), |
| 5984 end_memory_size_(0), | 5989 end_memory_size_(0), |
| 5985 collector_(collector), | 5990 collector_(collector), |
| 5986 allocated_since_last_gc_(0), | 5991 allocated_since_last_gc_(0), |
| 5987 spent_in_mutator_(0), | 5992 spent_in_mutator_(0), |
| 5988 nodes_died_in_new_space_(0), | |
| 5989 nodes_copied_in_new_space_(0), | |
| 5990 nodes_promoted_(0), | |
| 5991 heap_(heap), | 5993 heap_(heap), |
| 5992 gc_reason_(gc_reason), | 5994 gc_reason_(gc_reason), |
| 5993 collector_reason_(collector_reason) { | 5995 collector_reason_(collector_reason) { |
| 5994 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; | 5996 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; |
| 5995 | 5997 |
| 5996 start_time_ = base::OS::TimeCurrentMillis(); | 5998 start_time_ = base::OS::TimeCurrentMillis(); |
| 5997 start_object_size_ = heap_->SizeOfObjects(); | 5999 start_object_size_ = heap_->SizeOfObjects(); |
| 5998 start_memory_size_ = heap_->isolate()->memory_allocator()->Size(); | 6000 start_memory_size_ = heap_->isolate()->memory_allocator()->Size(); |
| 5999 | 6001 |
| 6000 for (int i = 0; i < Scope::NUMBER_OF_SCOPES; i++) { | 6002 for (int i = 0; i < Scope::NUMBER_OF_SCOPES; i++) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6128 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_object_size_); | 6130 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_object_size_); |
| 6129 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", end_object_size_); | 6131 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", end_object_size_); |
| 6130 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", | 6132 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", |
| 6131 in_free_list_or_wasted_before_gc_); | 6133 in_free_list_or_wasted_before_gc_); |
| 6132 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize(heap_)); | 6134 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize(heap_)); |
| 6133 | 6135 |
| 6134 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_); | 6136 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_); |
| 6135 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); | 6137 PrintF("promoted=%" V8_PTR_PREFIX "d ", heap_->promoted_objects_size_); |
| 6136 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", | 6138 PrintF("semi_space_copied=%" V8_PTR_PREFIX "d ", |
| 6137 heap_->semi_space_copied_object_size_); | 6139 heap_->semi_space_copied_object_size_); |
| 6138 PrintF("nodes_died_in_new=%d ", nodes_died_in_new_space_); | 6140 PrintF("nodes_died_in_new=%d ", heap_->nodes_died_in_new_space_); |
| 6139 PrintF("nodes_copied_in_new=%d ", nodes_copied_in_new_space_); | 6141 PrintF("nodes_copied_in_new=%d ", heap_->nodes_copied_in_new_space_); |
| 6140 PrintF("nodes_promoted=%d ", nodes_promoted_); | 6142 PrintF("nodes_promoted=%d ", heap_->nodes_promoted_); |
| 6141 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); | 6143 PrintF("promotion_rate=%.1f%% ", heap_->promotion_rate_); |
| 6142 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); | 6144 PrintF("semi_space_copy_rate=%.1f%% ", heap_->semi_space_copied_rate_); |
| 6143 | 6145 |
| 6144 if (collector_ == SCAVENGER) { | 6146 if (collector_ == SCAVENGER) { |
| 6145 PrintF("stepscount=%d ", steps_count_since_last_gc_); | 6147 PrintF("stepscount=%d ", steps_count_since_last_gc_); |
| 6146 PrintF("stepstook=%.1f ", steps_took_since_last_gc_); | 6148 PrintF("stepstook=%.1f ", steps_took_since_last_gc_); |
| 6147 } else { | 6149 } else { |
| 6148 PrintF("stepscount=%d ", steps_count_); | 6150 PrintF("stepscount=%d ", steps_count_); |
| 6149 PrintF("stepstook=%.1f ", steps_took_); | 6151 PrintF("stepstook=%.1f ", steps_took_); |
| 6150 PrintF("longeststep=%.1f ", longest_step_); | 6152 PrintF("longeststep=%.1f ", longest_step_); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6424 static_cast<int>(object_sizes_last_time_[index])); | 6426 static_cast<int>(object_sizes_last_time_[index])); |
| 6425 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6427 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6426 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6428 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6427 | 6429 |
| 6428 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6430 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6429 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6431 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6430 ClearObjectStats(); | 6432 ClearObjectStats(); |
| 6431 } | 6433 } |
| 6432 | 6434 |
| 6433 } } // namespace v8::internal | 6435 } } // namespace v8::internal |
| OLD | NEW |