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/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 4272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4283 bool Heap::WorthActivatingIncrementalMarking() { | 4283 bool Heap::WorthActivatingIncrementalMarking() { |
4284 return incremental_marking()->IsStopped() && | 4284 return incremental_marking()->IsStopped() && |
4285 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); | 4285 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); |
4286 } | 4286 } |
4287 | 4287 |
4288 | 4288 |
4289 bool Heap::IdleNotification(int idle_time_in_ms) { | 4289 bool Heap::IdleNotification(int idle_time_in_ms) { |
4290 // If incremental marking is off, we do not perform idle notification. | 4290 // If incremental marking is off, we do not perform idle notification. |
4291 if (!FLAG_incremental_marking) return true; | 4291 if (!FLAG_incremental_marking) return true; |
4292 base::ElapsedTimer timer; | 4292 base::ElapsedTimer timer; |
4293 if (FLAG_trace_idle_notification) { | 4293 timer.Start(); |
4294 timer.Start(); | |
4295 } | |
4296 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( | 4294 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( |
4297 idle_time_in_ms); | 4295 idle_time_in_ms); |
4298 HistogramTimerScope idle_notification_scope( | 4296 HistogramTimerScope idle_notification_scope( |
4299 isolate_->counters()->gc_idle_notification()); | 4297 isolate_->counters()->gc_idle_notification()); |
4300 | 4298 |
4301 GCIdleTimeHandler::HeapState heap_state; | 4299 GCIdleTimeHandler::HeapState heap_state; |
4302 heap_state.contexts_disposed = contexts_disposed_; | 4300 heap_state.contexts_disposed = contexts_disposed_; |
4303 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); | 4301 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); |
4304 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); | 4302 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); |
4305 // TODO(ulan): Start incremental marking only for large heaps. | 4303 // TODO(ulan): Start incremental marking only for large heaps. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4341 } | 4339 } |
4342 case DO_SCAVENGE: | 4340 case DO_SCAVENGE: |
4343 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); | 4341 CollectGarbage(NEW_SPACE, "idle notification: scavenge"); |
4344 break; | 4342 break; |
4345 case DO_FINALIZE_SWEEPING: | 4343 case DO_FINALIZE_SWEEPING: |
4346 mark_compact_collector()->EnsureSweepingCompleted(); | 4344 mark_compact_collector()->EnsureSweepingCompleted(); |
4347 break; | 4345 break; |
4348 case DO_NOTHING: | 4346 case DO_NOTHING: |
4349 break; | 4347 break; |
4350 } | 4348 } |
| 4349 |
| 4350 int actual_time_ms = static_cast<int>(timer.Elapsed().InMilliseconds()); |
| 4351 if (actual_time_ms <= idle_time_in_ms) { |
| 4352 isolate()->counters()->gc_idle_time_limit_undershot()->AddSample( |
| 4353 idle_time_in_ms - actual_time_ms); |
| 4354 } else { |
| 4355 isolate()->counters()->gc_idle_time_limit_overshot()->AddSample( |
| 4356 actual_time_ms - idle_time_in_ms); |
| 4357 } |
| 4358 |
4351 if (FLAG_trace_idle_notification) { | 4359 if (FLAG_trace_idle_notification) { |
4352 int actual_time_ms = static_cast<int>(timer.Elapsed().InMilliseconds()); | |
4353 PrintF("Idle notification: requested idle time %d ms, actual time %d ms [", | 4360 PrintF("Idle notification: requested idle time %d ms, actual time %d ms [", |
4354 idle_time_in_ms, actual_time_ms); | 4361 idle_time_in_ms, actual_time_ms); |
4355 action.Print(); | 4362 action.Print(); |
4356 PrintF("]\n"); | 4363 PrintF("]\n"); |
4357 } | 4364 } |
4358 | 4365 |
4359 contexts_disposed_ = 0; | 4366 contexts_disposed_ = 0; |
4360 return result; | 4367 return result; |
4361 } | 4368 } |
4362 | 4369 |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6131 static_cast<int>(object_sizes_last_time_[index])); | 6138 static_cast<int>(object_sizes_last_time_[index])); |
6132 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6139 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6133 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6140 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6134 | 6141 |
6135 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6142 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6136 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6143 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6137 ClearObjectStats(); | 6144 ClearObjectStats(); |
6138 } | 6145 } |
6139 } | 6146 } |
6140 } // namespace v8::internal | 6147 } // namespace v8::internal |
OLD | NEW |