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

Side by Side Diff: src/heap.cc

Issue 420753002: Added histogram to track distribution of requested idle notifications. (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
« src/heap.h ('K') | « src/heap.h ('k') | no next file » | 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.
rmcilroy 2014/07/25 09:38:29 move up to line above
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 incremental_marking_(this), 124 incremental_marking_(this),
124 number_idle_notifications_(0), 125 number_idle_notifications_(0),
125 last_idle_notification_gc_count_(0), 126 last_idle_notification_gc_count_(0),
126 last_idle_notification_gc_count_init_(false), 127 last_idle_notification_gc_count_init_(false),
127 mark_sweeps_since_idle_round_started_(0), 128 mark_sweeps_since_idle_round_started_(0),
128 gc_count_at_last_idle_gc_(0), 129 gc_count_at_last_idle_gc_(0),
129 scavenges_since_last_idle_round_(kIdleScavengeThreshold), 130 scavenges_since_last_idle_round_(kIdleScavengeThreshold),
130 full_codegen_bytes_generated_(0), 131 full_codegen_bytes_generated_(0),
131 crankshaft_codegen_bytes_generated_(0), 132 crankshaft_codegen_bytes_generated_(0),
132 gcs_since_last_deopt_(0), 133 gcs_since_last_deopt_(0),
134 idle_notification_histogram_(NULL),
133 #ifdef VERIFY_HEAP 135 #ifdef VERIFY_HEAP
134 no_weak_object_verification_scope_depth_(0), 136 no_weak_object_verification_scope_depth_(0),
135 #endif 137 #endif
136 allocation_sites_scratchpad_length_(0), 138 allocation_sites_scratchpad_length_(0),
137 promotion_queue_(this), 139 promotion_queue_(this),
138 configured_(false), 140 configured_(false),
139 external_string_table_(this), 141 external_string_table_(this),
140 chunks_queued_for_free_(NULL), 142 chunks_queued_for_free_(NULL),
141 gc_callbacks_depth_(0) { 143 gc_callbacks_depth_(0) {
142 // Allow build-time customization of the max semispace size. Building 144 // Allow build-time customization of the max semispace size. Building
(...skipping 4118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4261 const int kMinHintForIncrementalMarking = 10; 4263 const int kMinHintForIncrementalMarking = 10;
4262 // Minimal hint that allows to do full GC. 4264 // Minimal hint that allows to do full GC.
4263 const int kMinHintForFullGC = 100; 4265 const int kMinHintForFullGC = 100;
4264 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4; 4266 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4;
4265 // The size factor is in range [5..250]. The numbers here are chosen from 4267 // The size factor is in range [5..250]. The numbers here are chosen from
4266 // experiments. If you changes them, make sure to test with 4268 // experiments. If you changes them, make sure to test with
4267 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.* 4269 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.*
4268 intptr_t step_size = 4270 intptr_t step_size =
4269 size_factor * IncrementalMarking::kAllocatedThreshold; 4271 size_factor * IncrementalMarking::kAllocatedThreshold;
4270 4272
4273 isolate()->stats_table()->AddHistogramSample(idle_notification_histogram_,
4274 hint);
4271 HistogramTimerScope idle_notification_scope( 4275 HistogramTimerScope idle_notification_scope(
4272 isolate_->counters()->gc_idle_notification()); 4276 isolate_->counters()->gc_idle_notification());
4273 4277
4274 if (contexts_disposed_ > 0) { 4278 if (contexts_disposed_ > 0) {
4275 contexts_disposed_ = 0; 4279 contexts_disposed_ = 0;
4276 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); 4280 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000);
4277 if (hint >= mark_sweep_time && !FLAG_expose_gc && 4281 if (hint >= mark_sweep_time && !FLAG_expose_gc &&
4278 incremental_marking()->IsStopped()) { 4282 incremental_marking()->IsStopped()) {
4279 HistogramTimerScope scope(isolate_->counters()->gc_context()); 4283 HistogramTimerScope scope(isolate_->counters()->gc_context());
4280 CollectAllGarbage(kReduceMemoryFootprintMask, 4284 CollectAllGarbage(kReduceMemoryFootprintMask,
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
5125 // call Heap::TearDown() to release allocated memory. 5129 // call Heap::TearDown() to release allocated memory.
5126 // 5130 //
5127 // If the heap is not yet configured (e.g. through the API), configure it. 5131 // If the heap is not yet configured (e.g. through the API), configure it.
5128 // Configuration is based on the flags new-space-size (really the semispace 5132 // Configuration is based on the flags new-space-size (really the semispace
5129 // size) and old-space-size if set or the initial values of semispace_size_ 5133 // size) and old-space-size if set or the initial values of semispace_size_
5130 // and old_generation_size_ otherwise. 5134 // and old_generation_size_ otherwise.
5131 if (!configured_) { 5135 if (!configured_) {
5132 if (!ConfigureHeapDefault()) return false; 5136 if (!ConfigureHeapDefault()) return false;
5133 } 5137 }
5134 5138
5139 idle_notification_histogram_ = isolate()->stats_table()->CreateHistogram(
5140 "V8.IdleNotification", 0, kMaxIdleNotificationHistogramSample,
rmcilroy 2014/07/25 09:38:29 ditto (V8.IdleNotificationHint or V8.IdleGCAllotte
5141 kMaxIdleNotificationHistogramSample + 1);
5142
5135 base::CallOnce(&initialize_gc_once, &InitializeGCOnce); 5143 base::CallOnce(&initialize_gc_once, &InitializeGCOnce);
5136 5144
5137 MarkMapPointersAsEncoded(false); 5145 MarkMapPointersAsEncoded(false);
5138 5146
5139 // Set up memory allocator. 5147 // Set up memory allocator.
5140 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) 5148 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize()))
5141 return false; 5149 return false;
5142 5150
5143 // Set up new space. 5151 // Set up new space.
5144 if (!new_space_.SetUp(reserved_semispace_size_, max_semi_space_size_)) { 5152 if (!new_space_.SetUp(reserved_semispace_size_, max_semi_space_size_)) {
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
6450 static_cast<int>(object_sizes_last_time_[index])); 6458 static_cast<int>(object_sizes_last_time_[index]));
6451 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6459 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6452 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6460 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6453 6461
6454 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6462 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6455 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6463 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6456 ClearObjectStats(); 6464 ClearObjectStats();
6457 } 6465 }
6458 6466
6459 } } // namespace v8::internal 6467 } } // namespace v8::internal
OLDNEW
« src/heap.h ('K') | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698