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 4209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4220 void Heap::MakeHeapIterable() { | 4220 void Heap::MakeHeapIterable() { |
4221 ASSERT(AllowHeapAllocation::IsAllowed()); | 4221 ASSERT(AllowHeapAllocation::IsAllowed()); |
4222 if (!IsHeapIterable()) { | 4222 if (!IsHeapIterable()) { |
4223 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); | 4223 CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); |
4224 } | 4224 } |
4225 ASSERT(IsHeapIterable()); | 4225 ASSERT(IsHeapIterable()); |
4226 } | 4226 } |
4227 | 4227 |
4228 | 4228 |
4229 void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { | 4229 void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { |
| 4230 HistogramTimerScope idle_notification_scope( |
| 4231 isolate_->counters()->gc_incremental_marking()); |
| 4232 |
4230 incremental_marking()->Step(step_size, | 4233 incremental_marking()->Step(step_size, |
4231 IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 4234 IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
4232 | 4235 |
4233 if (incremental_marking()->IsComplete()) { | 4236 if (incremental_marking()->IsComplete()) { |
4234 bool uncommit = false; | 4237 bool uncommit = false; |
4235 if (gc_count_at_last_idle_gc_ == gc_count_) { | 4238 if (gc_count_at_last_idle_gc_ == gc_count_) { |
4236 // No GC since the last full GC, the mutator is probably not active. | 4239 // No GC since the last full GC, the mutator is probably not active. |
4237 isolate_->compilation_cache()->Clear(); | 4240 isolate_->compilation_cache()->Clear(); |
4238 uncommit = true; | 4241 uncommit = true; |
4239 } | 4242 } |
(...skipping 16 matching lines...) Expand all Loading... |
4256 const int kMinHintForIncrementalMarking = 10; | 4259 const int kMinHintForIncrementalMarking = 10; |
4257 // Minimal hint that allows to do full GC. | 4260 // Minimal hint that allows to do full GC. |
4258 const int kMinHintForFullGC = 100; | 4261 const int kMinHintForFullGC = 100; |
4259 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4; | 4262 intptr_t size_factor = Min(Max(hint, 20), kMaxHint) / 4; |
4260 // The size factor is in range [5..250]. The numbers here are chosen from | 4263 // The size factor is in range [5..250]. The numbers here are chosen from |
4261 // experiments. If you changes them, make sure to test with | 4264 // experiments. If you changes them, make sure to test with |
4262 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.* | 4265 // chrome/performance_ui_tests --gtest_filter="GeneralMixMemoryTest.* |
4263 intptr_t step_size = | 4266 intptr_t step_size = |
4264 size_factor * IncrementalMarking::kAllocatedThreshold; | 4267 size_factor * IncrementalMarking::kAllocatedThreshold; |
4265 | 4268 |
| 4269 HistogramTimerScope idle_notification_scope( |
| 4270 isolate_->counters()->gc_idle_notification()); |
| 4271 |
4266 if (contexts_disposed_ > 0) { | 4272 if (contexts_disposed_ > 0) { |
4267 contexts_disposed_ = 0; | 4273 contexts_disposed_ = 0; |
4268 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); | 4274 int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); |
4269 if (hint >= mark_sweep_time && !FLAG_expose_gc && | 4275 if (hint >= mark_sweep_time && !FLAG_expose_gc && |
4270 incremental_marking()->IsStopped()) { | 4276 incremental_marking()->IsStopped()) { |
4271 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 4277 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
4272 CollectAllGarbage(kReduceMemoryFootprintMask, | 4278 CollectAllGarbage(kReduceMemoryFootprintMask, |
4273 "idle notification: contexts disposed"); | 4279 "idle notification: contexts disposed"); |
4274 } else { | 4280 } else { |
4275 AdvanceIdleIncrementalMarking(step_size); | 4281 AdvanceIdleIncrementalMarking(step_size); |
(...skipping 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6426 static_cast<int>(object_sizes_last_time_[index])); | 6432 static_cast<int>(object_sizes_last_time_[index])); |
6427 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6433 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6428 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6434 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6429 | 6435 |
6430 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6436 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6431 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6437 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6432 ClearObjectStats(); | 6438 ClearObjectStats(); |
6433 } | 6439 } |
6434 | 6440 |
6435 } } // namespace v8::internal | 6441 } } // namespace v8::internal |
OLD | NEW |