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 4374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4385 } | 4385 } |
4386 | 4386 |
4387 | 4387 |
4388 bool Heap::WorthActivatingIncrementalMarking() { | 4388 bool Heap::WorthActivatingIncrementalMarking() { |
4389 return incremental_marking()->IsStopped() && | 4389 return incremental_marking()->IsStopped() && |
4390 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); | 4390 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); |
4391 } | 4391 } |
4392 | 4392 |
4393 | 4393 |
4394 bool Heap::IdleNotification(int idle_time_in_ms) { | 4394 bool Heap::IdleNotification(int idle_time_in_ms) { |
4395 // If incremental marking is off, we do not perform idle notification. | |
4396 if (!FLAG_incremental_marking) return true; | |
4397 base::ElapsedTimer timer; | 4395 base::ElapsedTimer timer; |
4398 timer.Start(); | 4396 timer.Start(); |
4399 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( | 4397 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( |
4400 idle_time_in_ms); | 4398 idle_time_in_ms); |
4401 HistogramTimerScope idle_notification_scope( | 4399 HistogramTimerScope idle_notification_scope( |
4402 isolate_->counters()->gc_idle_notification()); | 4400 isolate_->counters()->gc_idle_notification()); |
4403 | 4401 |
4404 GCIdleTimeHandler::HeapState heap_state; | 4402 GCIdleTimeHandler::HeapState heap_state; |
4405 heap_state.contexts_disposed = contexts_disposed_; | 4403 heap_state.contexts_disposed = contexts_disposed_; |
4406 heap_state.contexts_disposal_rate = | 4404 heap_state.contexts_disposal_rate = |
4407 tracer()->ContextDisposalRateInMilliseconds(); | 4405 tracer()->ContextDisposalRateInMilliseconds(); |
4408 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); | 4406 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); |
4409 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); | 4407 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); |
4410 // TODO(ulan): Start incremental marking only for large heaps. | 4408 // TODO(ulan): Start incremental marking only for large heaps. |
4411 heap_state.can_start_incremental_marking = | 4409 heap_state.can_start_incremental_marking = |
4412 incremental_marking()->ShouldActivate(); | 4410 incremental_marking()->ShouldActivate() && FLAG_incremental_marking; |
4413 heap_state.sweeping_in_progress = | 4411 heap_state.sweeping_in_progress = |
4414 mark_compact_collector()->sweeping_in_progress(); | 4412 mark_compact_collector()->sweeping_in_progress(); |
4415 heap_state.mark_compact_speed_in_bytes_per_ms = | 4413 heap_state.mark_compact_speed_in_bytes_per_ms = |
4416 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); | 4414 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); |
4417 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>( | 4415 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>( |
4418 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); | 4416 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); |
4419 heap_state.scavenge_speed_in_bytes_per_ms = | 4417 heap_state.scavenge_speed_in_bytes_per_ms = |
4420 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); | 4418 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); |
4421 heap_state.used_new_space_size = new_space_.Size(); | 4419 heap_state.used_new_space_size = new_space_.Size(); |
4422 heap_state.new_space_capacity = new_space_.Capacity(); | 4420 heap_state.new_space_capacity = new_space_.Capacity(); |
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6304 static_cast<int>(object_sizes_last_time_[index])); | 6302 static_cast<int>(object_sizes_last_time_[index])); |
6305 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6303 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6306 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6304 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6307 | 6305 |
6308 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6306 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6309 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6307 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6310 ClearObjectStats(); | 6308 ClearObjectStats(); |
6311 } | 6309 } |
6312 } | 6310 } |
6313 } // namespace v8::internal | 6311 } // namespace v8::internal |
OLD | NEW |