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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
839 } | 839 } |
840 | 840 |
841 GarbageCollectionEpilogue(); | 841 GarbageCollectionEpilogue(); |
842 tracer()->Stop(); | 842 tracer()->Stop(); |
843 } | 843 } |
844 | 844 |
845 // Start incremental marking for the next cycle. The heap snapshot | 845 // Start incremental marking for the next cycle. The heap snapshot |
846 // generator needs incremental marking to stay off after it aborted. | 846 // generator needs incremental marking to stay off after it aborted. |
847 if (!mark_compact_collector()->abort_incremental_marking() && | 847 if (!mark_compact_collector()->abort_incremental_marking() && |
848 incremental_marking()->IsStopped() && | 848 incremental_marking()->IsStopped() && |
849 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull()) { | 849 WorthActivatingIncrementalMarking()) { |
850 incremental_marking()->Start(); | 850 incremental_marking()->Start(); |
851 } | 851 } |
852 | 852 |
853 return next_gc_likely_to_collect_more; | 853 return next_gc_likely_to_collect_more; |
854 } | 854 } |
855 | 855 |
856 | 856 |
857 int Heap::NotifyContextDisposed() { | 857 int Heap::NotifyContextDisposed() { |
858 if (isolate()->concurrent_recompilation_enabled()) { | 858 if (isolate()->concurrent_recompilation_enabled()) { |
859 // Flush the queued recompilation tasks. | 859 // Flush the queued recompilation tasks. |
(...skipping 3416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4276 gc_idle_time_handler_.NotifyIdleMarkCompact(); | 4276 gc_idle_time_handler_.NotifyIdleMarkCompact(); |
4277 gc_count_at_last_idle_gc_ = gc_count_; | 4277 gc_count_at_last_idle_gc_ = gc_count_; |
4278 if (uncommit) { | 4278 if (uncommit) { |
4279 new_space_.Shrink(); | 4279 new_space_.Shrink(); |
4280 UncommitFromSpace(); | 4280 UncommitFromSpace(); |
4281 } | 4281 } |
4282 } | 4282 } |
4283 } | 4283 } |
4284 | 4284 |
4285 | 4285 |
4286 bool Heap::WorthActivatingIncrementalMarking() { | |
4287 return incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); | |
4288 } | |
4289 | |
4290 | |
4286 bool Heap::IdleNotification(int idle_time_in_ms) { | 4291 bool Heap::IdleNotification(int idle_time_in_ms) { |
4287 // If incremental marking is off, we do not perform idle notification. | 4292 // If incremental marking is off, we do not perform idle notification. |
4288 if (!FLAG_incremental_marking) return true; | 4293 if (!FLAG_incremental_marking) return true; |
4289 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( | 4294 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( |
4290 idle_time_in_ms); | 4295 idle_time_in_ms); |
4291 HistogramTimerScope idle_notification_scope( | 4296 HistogramTimerScope idle_notification_scope( |
4292 isolate_->counters()->gc_idle_notification()); | 4297 isolate_->counters()->gc_idle_notification()); |
4293 | 4298 |
4294 GCIdleTimeAction action = gc_idle_time_handler_.Compute( | 4299 GCIdleTimeAction action = gc_idle_time_handler_.Compute( |
4295 idle_time_in_ms, contexts_disposed_, static_cast<size_t>(SizeOfObjects()), | 4300 idle_time_in_ms, contexts_disposed_, static_cast<size_t>(SizeOfObjects()), |
4296 incremental_marking()->IsStopped(), tracer()); | 4301 incremental_marking()->IsStopped(), tracer()); |
4297 contexts_disposed_ = 0; | 4302 contexts_disposed_ = 0; |
4298 bool result = false; | 4303 bool result = false; |
4299 switch (action.type) { | 4304 switch (action.type) { |
4300 case DO_INCREMENTAL_MARKING: | 4305 case DO_INCREMENTAL_MARKING: |
4301 if (incremental_marking()->IsStopped()) { | 4306 if (incremental_marking()->IsStopped() && |
4307 WorthActivatingIncrementalMarking()) { | |
Hannes Payer (out of office)
2014/08/21 15:25:18
As discussed offline, can we move that into GCIdle
| |
4302 incremental_marking()->Start(); | 4308 incremental_marking()->Start(); |
4303 } | 4309 } |
4304 AdvanceIdleIncrementalMarking(action.parameter); | 4310 AdvanceIdleIncrementalMarking(action.parameter); |
4305 break; | 4311 break; |
4306 case DO_FULL_GC: { | 4312 case DO_FULL_GC: { |
4307 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 4313 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
4308 const char* message = contexts_disposed_ | 4314 const char* message = contexts_disposed_ |
4309 ? "idle notification: contexts disposed" | 4315 ? "idle notification: contexts disposed" |
4310 : "idle notification: finalize idle round"; | 4316 : "idle notification: finalize idle round"; |
4311 CollectAllGarbage(kReduceMemoryFootprintMask, message); | 4317 CollectAllGarbage(kReduceMemoryFootprintMask, message); |
(...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6100 static_cast<int>(object_sizes_last_time_[index])); | 6106 static_cast<int>(object_sizes_last_time_[index])); |
6101 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6107 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6102 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6108 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6103 | 6109 |
6104 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6110 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6105 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6111 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6106 ClearObjectStats(); | 6112 ClearObjectStats(); |
6107 } | 6113 } |
6108 } | 6114 } |
6109 } // namespace v8::internal | 6115 } // namespace v8::internal |
OLD | NEW |