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 4356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4367 gc_count_at_last_idle_gc_ = gc_count_; | 4367 gc_count_at_last_idle_gc_ = gc_count_; |
4368 if (uncommit) { | 4368 if (uncommit) { |
4369 new_space_.Shrink(); | 4369 new_space_.Shrink(); |
4370 UncommitFromSpace(); | 4370 UncommitFromSpace(); |
4371 } | 4371 } |
4372 } | 4372 } |
4373 | 4373 |
4374 | 4374 |
4375 void Heap::TryFinalizeIdleIncrementalMarking( | 4375 void Heap::TryFinalizeIdleIncrementalMarking( |
4376 size_t idle_time_in_ms, size_t size_of_objects, | 4376 size_t idle_time_in_ms, size_t size_of_objects, |
4377 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { | 4377 size_t mark_compact_speed_in_bytes_per_ms) { |
4378 if (incremental_marking()->IsComplete() || | 4378 if (incremental_marking()->IsComplete() || |
4379 (mark_compact_collector()->IsMarkingDequeEmpty() && | 4379 (mark_compact_collector()->IsMarkingDequeEmpty() && |
4380 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( | 4380 gc_idle_time_handler_.ShouldDoMarkCompact( |
4381 idle_time_in_ms, size_of_objects, | 4381 idle_time_in_ms, size_of_objects, |
4382 final_incremental_mark_compact_speed_in_bytes_per_ms))) { | 4382 mark_compact_speed_in_bytes_per_ms))) { |
4383 IdleMarkCompact("idle notification: finalize incremental"); | 4383 IdleMarkCompact("idle notification: finalize incremental"); |
4384 } | 4384 } |
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 |
(...skipping 14 matching lines...) Expand all Loading... |
4407 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); | 4407 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); |
4408 // TODO(ulan): Start incremental marking only for large heaps. | 4408 // TODO(ulan): Start incremental marking only for large heaps. |
4409 heap_state.can_start_incremental_marking = | 4409 heap_state.can_start_incremental_marking = |
4410 incremental_marking()->ShouldActivate() && FLAG_incremental_marking; | 4410 incremental_marking()->ShouldActivate() && FLAG_incremental_marking; |
4411 heap_state.sweeping_in_progress = | 4411 heap_state.sweeping_in_progress = |
4412 mark_compact_collector()->sweeping_in_progress(); | 4412 mark_compact_collector()->sweeping_in_progress(); |
4413 heap_state.mark_compact_speed_in_bytes_per_ms = | 4413 heap_state.mark_compact_speed_in_bytes_per_ms = |
4414 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); | 4414 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); |
4415 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>( |
4416 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); | 4416 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); |
4417 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms = | |
4418 static_cast<size_t>( | |
4419 tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); | |
4420 heap_state.scavenge_speed_in_bytes_per_ms = | 4417 heap_state.scavenge_speed_in_bytes_per_ms = |
4421 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); | 4418 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); |
4422 heap_state.used_new_space_size = new_space_.Size(); | 4419 heap_state.used_new_space_size = new_space_.Size(); |
4423 heap_state.new_space_capacity = new_space_.Capacity(); | 4420 heap_state.new_space_capacity = new_space_.Capacity(); |
4424 heap_state.new_space_allocation_throughput_in_bytes_per_ms = | 4421 heap_state.new_space_allocation_throughput_in_bytes_per_ms = |
4425 static_cast<size_t>( | 4422 static_cast<size_t>( |
4426 tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond()); | 4423 tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond()); |
4427 | 4424 |
4428 GCIdleTimeAction action = | 4425 GCIdleTimeAction action = |
4429 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); | 4426 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); |
(...skipping 10 matching lines...) Expand all Loading... |
4440 } | 4437 } |
4441 incremental_marking()->Step(action.parameter, | 4438 incremental_marking()->Step(action.parameter, |
4442 IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 4439 IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
4443 IncrementalMarking::FORCE_MARKING, | 4440 IncrementalMarking::FORCE_MARKING, |
4444 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 4441 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
4445 actual_time_in_ms = static_cast<int>(timer.Elapsed().InMilliseconds()); | 4442 actual_time_in_ms = static_cast<int>(timer.Elapsed().InMilliseconds()); |
4446 int remaining_idle_time_in_ms = idle_time_in_ms - actual_time_in_ms; | 4443 int remaining_idle_time_in_ms = idle_time_in_ms - actual_time_in_ms; |
4447 if (remaining_idle_time_in_ms > 0) { | 4444 if (remaining_idle_time_in_ms > 0) { |
4448 TryFinalizeIdleIncrementalMarking( | 4445 TryFinalizeIdleIncrementalMarking( |
4449 remaining_idle_time_in_ms, heap_state.size_of_objects, | 4446 remaining_idle_time_in_ms, heap_state.size_of_objects, |
4450 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms); | 4447 heap_state.mark_compact_speed_in_bytes_per_ms); |
4451 } | 4448 } |
4452 break; | 4449 break; |
4453 } | 4450 } |
4454 case DO_FULL_GC: { | 4451 case DO_FULL_GC: { |
4455 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 4452 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
4456 if (contexts_disposed_) { | 4453 if (contexts_disposed_) { |
4457 CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); | 4454 CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); |
4458 gc_idle_time_handler_.NotifyIdleMarkCompact(); | 4455 gc_idle_time_handler_.NotifyIdleMarkCompact(); |
4459 gc_count_at_last_idle_gc_ = gc_count_; | 4456 gc_count_at_last_idle_gc_ = gc_count_; |
4460 } else { | 4457 } else { |
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6314 static_cast<int>(object_sizes_last_time_[index])); | 6311 static_cast<int>(object_sizes_last_time_[index])); |
6315 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6312 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6316 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6313 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6317 | 6314 |
6318 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6315 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6319 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6316 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6320 ClearObjectStats(); | 6317 ClearObjectStats(); |
6321 } | 6318 } |
6322 } | 6319 } |
6323 } // namespace v8::internal | 6320 } // namespace v8::internal |
OLD | NEW |