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/heap/heap.h" | 5 #include "src/heap/heap.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/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
11 #include "src/base/utils/random-number-generator.h" | 11 #include "src/base/utils/random-number-generator.h" |
12 #include "src/bootstrapper.h" | 12 #include "src/bootstrapper.h" |
13 #include "src/codegen.h" | 13 #include "src/codegen.h" |
14 #include "src/compilation-cache.h" | 14 #include "src/compilation-cache.h" |
15 #include "src/conversions.h" | 15 #include "src/conversions.h" |
16 #include "src/cpu-profiler.h" | 16 #include "src/cpu-profiler.h" |
17 #include "src/debug/debug.h" | 17 #include "src/debug/debug.h" |
18 #include "src/deoptimizer.h" | 18 #include "src/deoptimizer.h" |
19 #include "src/global-handles.h" | 19 #include "src/global-handles.h" |
20 #include "src/heap/gc-idle-time-handler.h" | 20 #include "src/heap/gc-idle-time-handler.h" |
| 21 #include "src/heap/gc-tracer.h" |
21 #include "src/heap/incremental-marking.h" | 22 #include "src/heap/incremental-marking.h" |
22 #include "src/heap/mark-compact-inl.h" | 23 #include "src/heap/mark-compact-inl.h" |
23 #include "src/heap/mark-compact.h" | 24 #include "src/heap/mark-compact.h" |
24 #include "src/heap/memory-reducer.h" | 25 #include "src/heap/memory-reducer.h" |
25 #include "src/heap/objects-visiting-inl.h" | 26 #include "src/heap/objects-visiting-inl.h" |
26 #include "src/heap/objects-visiting.h" | 27 #include "src/heap/objects-visiting.h" |
27 #include "src/heap/store-buffer.h" | 28 #include "src/heap/store-buffer.h" |
28 #include "src/heap-profiler.h" | 29 #include "src/heap-profiler.h" |
29 #include "src/interpreter/interpreter.h" | 30 #include "src/interpreter/interpreter.h" |
30 #include "src/runtime-profiler.h" | 31 #include "src/runtime-profiler.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 remembered_unmapped_pages_index_(0), | 91 remembered_unmapped_pages_index_(0), |
91 #ifdef DEBUG | 92 #ifdef DEBUG |
92 allocation_timeout_(0), | 93 allocation_timeout_(0), |
93 #endif // DEBUG | 94 #endif // DEBUG |
94 old_generation_allocation_limit_(initial_old_generation_size_), | 95 old_generation_allocation_limit_(initial_old_generation_size_), |
95 old_gen_exhausted_(false), | 96 old_gen_exhausted_(false), |
96 optimize_for_memory_usage_(false), | 97 optimize_for_memory_usage_(false), |
97 inline_allocation_disabled_(false), | 98 inline_allocation_disabled_(false), |
98 store_buffer_rebuilder_(store_buffer()), | 99 store_buffer_rebuilder_(store_buffer()), |
99 total_regexp_code_generated_(0), | 100 total_regexp_code_generated_(0), |
100 tracer_(this), | 101 tracer_(nullptr), |
101 high_survival_rate_period_length_(0), | 102 high_survival_rate_period_length_(0), |
102 promoted_objects_size_(0), | 103 promoted_objects_size_(0), |
103 promotion_ratio_(0), | 104 promotion_ratio_(0), |
104 semi_space_copied_object_size_(0), | 105 semi_space_copied_object_size_(0), |
105 previous_semi_space_copied_object_size_(0), | 106 previous_semi_space_copied_object_size_(0), |
106 semi_space_copied_rate_(0), | 107 semi_space_copied_rate_(0), |
107 nodes_died_in_new_space_(0), | 108 nodes_died_in_new_space_(0), |
108 nodes_copied_in_new_space_(0), | 109 nodes_copied_in_new_space_(0), |
109 nodes_promoted_(0), | 110 nodes_promoted_(0), |
110 maximum_size_scavenges_(0), | 111 maximum_size_scavenges_(0), |
(...skipping 5688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5799 } else { | 5800 } else { |
5800 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); | 5801 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); |
5801 } | 5802 } |
5802 } | 5803 } |
5803 | 5804 |
5804 for (int i = 0; i < static_cast<int>(v8::Isolate::kUseCounterFeatureCount); | 5805 for (int i = 0; i < static_cast<int>(v8::Isolate::kUseCounterFeatureCount); |
5805 i++) { | 5806 i++) { |
5806 deferred_counters_[i] = 0; | 5807 deferred_counters_[i] = 0; |
5807 } | 5808 } |
5808 | 5809 |
| 5810 tracer_ = new GCTracer(this); |
5809 | 5811 |
5810 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); | 5812 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); |
5811 LOG(isolate_, IntPtrTEvent("heap-available", Available())); | 5813 LOG(isolate_, IntPtrTEvent("heap-available", Available())); |
5812 | 5814 |
5813 store_buffer()->SetUp(); | 5815 store_buffer()->SetUp(); |
5814 | 5816 |
5815 mark_compact_collector()->SetUp(); | 5817 mark_compact_collector()->SetUp(); |
5816 | 5818 |
5817 return true; | 5819 return true; |
5818 } | 5820 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5871 UpdateMaximumCommitted(); | 5873 UpdateMaximumCommitted(); |
5872 | 5874 |
5873 if (FLAG_print_cumulative_gc_stat) { | 5875 if (FLAG_print_cumulative_gc_stat) { |
5874 PrintF("\n"); | 5876 PrintF("\n"); |
5875 PrintF("gc_count=%d ", gc_count_); | 5877 PrintF("gc_count=%d ", gc_count_); |
5876 PrintF("mark_sweep_count=%d ", ms_count_); | 5878 PrintF("mark_sweep_count=%d ", ms_count_); |
5877 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); | 5879 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); |
5878 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); | 5880 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); |
5879 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); | 5881 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); |
5880 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", get_max_alive_after_gc()); | 5882 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", get_max_alive_after_gc()); |
5881 PrintF("total_marking_time=%.1f ", tracer_.cumulative_marking_duration()); | 5883 PrintF("total_marking_time=%.1f ", tracer()->cumulative_marking_duration()); |
5882 PrintF("total_sweeping_time=%.1f ", tracer_.cumulative_sweeping_duration()); | 5884 PrintF("total_sweeping_time=%.1f ", |
| 5885 tracer()->cumulative_sweeping_duration()); |
5883 PrintF("\n\n"); | 5886 PrintF("\n\n"); |
5884 } | 5887 } |
5885 | 5888 |
5886 if (FLAG_print_max_heap_committed) { | 5889 if (FLAG_print_max_heap_committed) { |
5887 PrintF("\n"); | 5890 PrintF("\n"); |
5888 PrintF("maximum_committed_by_heap=%" V8_PTR_PREFIX "d ", | 5891 PrintF("maximum_committed_by_heap=%" V8_PTR_PREFIX "d ", |
5889 MaximumCommittedMemory()); | 5892 MaximumCommittedMemory()); |
5890 PrintF("maximum_committed_by_new_space=%" V8_PTR_PREFIX "d ", | 5893 PrintF("maximum_committed_by_new_space=%" V8_PTR_PREFIX "d ", |
5891 new_space_.MaximumCommittedMemory()); | 5894 new_space_.MaximumCommittedMemory()); |
5892 PrintF("maximum_committed_by_old_space=%" V8_PTR_PREFIX "d ", | 5895 PrintF("maximum_committed_by_old_space=%" V8_PTR_PREFIX "d ", |
(...skipping 14 matching lines...) Expand all Loading... |
5907 memory_reducer_.TearDown(); | 5910 memory_reducer_.TearDown(); |
5908 | 5911 |
5909 TearDownArrayBuffers(); | 5912 TearDownArrayBuffers(); |
5910 | 5913 |
5911 isolate_->global_handles()->TearDown(); | 5914 isolate_->global_handles()->TearDown(); |
5912 | 5915 |
5913 external_string_table_.TearDown(); | 5916 external_string_table_.TearDown(); |
5914 | 5917 |
5915 mark_compact_collector()->TearDown(); | 5918 mark_compact_collector()->TearDown(); |
5916 | 5919 |
| 5920 delete tracer_; |
| 5921 tracer_ = nullptr; |
| 5922 |
5917 new_space_.TearDown(); | 5923 new_space_.TearDown(); |
5918 | 5924 |
5919 if (old_space_ != NULL) { | 5925 if (old_space_ != NULL) { |
5920 old_space_->TearDown(); | 5926 old_space_->TearDown(); |
5921 delete old_space_; | 5927 delete old_space_; |
5922 old_space_ = NULL; | 5928 old_space_ = NULL; |
5923 } | 5929 } |
5924 | 5930 |
5925 if (code_space_ != NULL) { | 5931 if (code_space_ != NULL) { |
5926 code_space_->TearDown(); | 5932 code_space_->TearDown(); |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6903 *object_type = "CODE_TYPE"; \ | 6909 *object_type = "CODE_TYPE"; \ |
6904 *object_sub_type = "CODE_AGE/" #name; \ | 6910 *object_sub_type = "CODE_AGE/" #name; \ |
6905 return true; | 6911 return true; |
6906 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6912 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6907 #undef COMPARE_AND_RETURN_NAME | 6913 #undef COMPARE_AND_RETURN_NAME |
6908 } | 6914 } |
6909 return false; | 6915 return false; |
6910 } | 6916 } |
6911 } // namespace internal | 6917 } // namespace internal |
6912 } // namespace v8 | 6918 } // namespace v8 |
OLD | NEW |