| 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 4369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4380 gc_count_at_last_idle_gc_ = gc_count_; | 4380 gc_count_at_last_idle_gc_ = gc_count_; |
| 4381 if (uncommit) { | 4381 if (uncommit) { |
| 4382 new_space_.Shrink(); | 4382 new_space_.Shrink(); |
| 4383 UncommitFromSpace(); | 4383 UncommitFromSpace(); |
| 4384 } | 4384 } |
| 4385 } | 4385 } |
| 4386 | 4386 |
| 4387 | 4387 |
| 4388 void Heap::TryFinalizeIdleIncrementalMarking( | 4388 void Heap::TryFinalizeIdleIncrementalMarking( |
| 4389 size_t idle_time_in_ms, size_t size_of_objects, | 4389 size_t idle_time_in_ms, size_t size_of_objects, |
| 4390 size_t mark_compact_speed_in_bytes_per_ms) { | 4390 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { |
| 4391 if (incremental_marking()->IsComplete() || | 4391 if (incremental_marking()->IsComplete() || |
| 4392 (mark_compact_collector()->IsMarkingDequeEmpty() && | 4392 (mark_compact_collector()->IsMarkingDequeEmpty() && |
| 4393 gc_idle_time_handler_.ShouldDoMarkCompact( | 4393 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( |
| 4394 idle_time_in_ms, size_of_objects, | 4394 idle_time_in_ms, size_of_objects, |
| 4395 mark_compact_speed_in_bytes_per_ms))) { | 4395 final_incremental_mark_compact_speed_in_bytes_per_ms))) { |
| 4396 IdleMarkCompact("idle notification: finalize incremental"); | 4396 IdleMarkCompact("idle notification: finalize incremental"); |
| 4397 } | 4397 } |
| 4398 } | 4398 } |
| 4399 | 4399 |
| 4400 | 4400 |
| 4401 bool Heap::WorthActivatingIncrementalMarking() { | 4401 bool Heap::WorthActivatingIncrementalMarking() { |
| 4402 return incremental_marking()->IsStopped() && | 4402 return incremental_marking()->IsStopped() && |
| 4403 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); | 4403 incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); |
| 4404 } | 4404 } |
| 4405 | 4405 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 4420 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); | 4420 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); |
| 4421 // TODO(ulan): Start incremental marking only for large heaps. | 4421 // TODO(ulan): Start incremental marking only for large heaps. |
| 4422 heap_state.can_start_incremental_marking = | 4422 heap_state.can_start_incremental_marking = |
| 4423 incremental_marking()->ShouldActivate() && FLAG_incremental_marking; | 4423 incremental_marking()->ShouldActivate() && FLAG_incremental_marking; |
| 4424 heap_state.sweeping_in_progress = | 4424 heap_state.sweeping_in_progress = |
| 4425 mark_compact_collector()->sweeping_in_progress(); | 4425 mark_compact_collector()->sweeping_in_progress(); |
| 4426 heap_state.mark_compact_speed_in_bytes_per_ms = | 4426 heap_state.mark_compact_speed_in_bytes_per_ms = |
| 4427 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); | 4427 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); |
| 4428 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>( | 4428 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>( |
| 4429 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); | 4429 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); |
| 4430 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms = |
| 4431 static_cast<size_t>( |
| 4432 tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond()); |
| 4430 heap_state.scavenge_speed_in_bytes_per_ms = | 4433 heap_state.scavenge_speed_in_bytes_per_ms = |
| 4431 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); | 4434 static_cast<size_t>(tracer()->ScavengeSpeedInBytesPerMillisecond()); |
| 4432 heap_state.used_new_space_size = new_space_.Size(); | 4435 heap_state.used_new_space_size = new_space_.Size(); |
| 4433 heap_state.new_space_capacity = new_space_.Capacity(); | 4436 heap_state.new_space_capacity = new_space_.Capacity(); |
| 4434 heap_state.new_space_allocation_throughput_in_bytes_per_ms = | 4437 heap_state.new_space_allocation_throughput_in_bytes_per_ms = |
| 4435 static_cast<size_t>( | 4438 static_cast<size_t>( |
| 4436 tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond()); | 4439 tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond()); |
| 4437 | 4440 |
| 4438 GCIdleTimeAction action = | 4441 GCIdleTimeAction action = |
| 4439 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); | 4442 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4450 } | 4453 } |
| 4451 incremental_marking()->Step(action.parameter, | 4454 incremental_marking()->Step(action.parameter, |
| 4452 IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 4455 IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 4453 IncrementalMarking::FORCE_MARKING, | 4456 IncrementalMarking::FORCE_MARKING, |
| 4454 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 4457 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
| 4455 actual_time_in_ms = static_cast<int>(timer.Elapsed().InMilliseconds()); | 4458 actual_time_in_ms = static_cast<int>(timer.Elapsed().InMilliseconds()); |
| 4456 int remaining_idle_time_in_ms = idle_time_in_ms - actual_time_in_ms; | 4459 int remaining_idle_time_in_ms = idle_time_in_ms - actual_time_in_ms; |
| 4457 if (remaining_idle_time_in_ms > 0) { | 4460 if (remaining_idle_time_in_ms > 0) { |
| 4458 TryFinalizeIdleIncrementalMarking( | 4461 TryFinalizeIdleIncrementalMarking( |
| 4459 remaining_idle_time_in_ms, heap_state.size_of_objects, | 4462 remaining_idle_time_in_ms, heap_state.size_of_objects, |
| 4460 heap_state.mark_compact_speed_in_bytes_per_ms); | 4463 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms); |
| 4461 } | 4464 } |
| 4462 break; | 4465 break; |
| 4463 } | 4466 } |
| 4464 case DO_FULL_GC: { | 4467 case DO_FULL_GC: { |
| 4465 HistogramTimerScope scope(isolate_->counters()->gc_context()); | 4468 HistogramTimerScope scope(isolate_->counters()->gc_context()); |
| 4466 if (contexts_disposed_) { | 4469 if (contexts_disposed_) { |
| 4467 CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); | 4470 CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); |
| 4468 gc_idle_time_handler_.NotifyIdleMarkCompact(); | 4471 gc_idle_time_handler_.NotifyIdleMarkCompact(); |
| 4469 gc_count_at_last_idle_gc_ = gc_count_; | 4472 gc_count_at_last_idle_gc_ = gc_count_; |
| 4470 } else { | 4473 } else { |
| (...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6325 static_cast<int>(object_sizes_last_time_[index])); | 6328 static_cast<int>(object_sizes_last_time_[index])); |
| 6326 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6329 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6327 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6330 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6328 | 6331 |
| 6329 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6332 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6330 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6333 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6331 ClearObjectStats(); | 6334 ClearObjectStats(); |
| 6332 } | 6335 } |
| 6333 } | 6336 } |
| 6334 } // namespace v8::internal | 6337 } // namespace v8::internal |
| OLD | NEW |