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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 GarbageCollectionEpilogue(); | 867 GarbageCollectionEpilogue(); |
868 if (collector == MARK_COMPACTOR && FLAG_track_detached_contexts) { | 868 if (collector == MARK_COMPACTOR && FLAG_track_detached_contexts) { |
869 isolate()->CheckDetachedContextsAfterGC(); | 869 isolate()->CheckDetachedContextsAfterGC(); |
870 } | 870 } |
871 tracer()->Stop(collector); | 871 tracer()->Stop(collector); |
872 } | 872 } |
873 | 873 |
874 // Start incremental marking for the next cycle. The heap snapshot | 874 // Start incremental marking for the next cycle. The heap snapshot |
875 // generator needs incremental marking to stay off after it aborted. | 875 // generator needs incremental marking to stay off after it aborted. |
876 if (!mark_compact_collector()->abort_incremental_marking() && | 876 if (!mark_compact_collector()->abort_incremental_marking() && |
877 WorthActivatingIncrementalMarking()) { | 877 incremental_marking()->IsStopped() && |
| 878 incremental_marking()->ShouldActivateEvenWithoutIdleNotification()) { |
878 incremental_marking()->Start(); | 879 incremental_marking()->Start(); |
879 } | 880 } |
880 | 881 |
881 return next_gc_likely_to_collect_more; | 882 return next_gc_likely_to_collect_more; |
882 } | 883 } |
883 | 884 |
884 | 885 |
885 int Heap::NotifyContextDisposed(bool dependant_context) { | 886 int Heap::NotifyContextDisposed(bool dependant_context) { |
886 if (!dependant_context) { | 887 if (!dependant_context) { |
887 tracer()->ResetSurvivalEvents(); | 888 tracer()->ResetSurvivalEvents(); |
(...skipping 3650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4538 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( | 4539 gc_idle_time_handler_.ShouldDoFinalIncrementalMarkCompact( |
4539 static_cast<size_t>(idle_time_in_ms), size_of_objects, | 4540 static_cast<size_t>(idle_time_in_ms), size_of_objects, |
4540 final_incremental_mark_compact_speed_in_bytes_per_ms))) { | 4541 final_incremental_mark_compact_speed_in_bytes_per_ms))) { |
4541 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); | 4542 CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); |
4542 return true; | 4543 return true; |
4543 } | 4544 } |
4544 return false; | 4545 return false; |
4545 } | 4546 } |
4546 | 4547 |
4547 | 4548 |
4548 bool Heap::WorthActivatingIncrementalMarking() { | |
4549 return incremental_marking()->IsStopped() && | |
4550 incremental_marking()->ShouldActivate(); | |
4551 } | |
4552 | |
4553 | |
4554 static double MonotonicallyIncreasingTimeInMs() { | 4549 static double MonotonicallyIncreasingTimeInMs() { |
4555 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * | 4550 return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * |
4556 static_cast<double>(base::Time::kMillisecondsPerSecond); | 4551 static_cast<double>(base::Time::kMillisecondsPerSecond); |
4557 } | 4552 } |
4558 | 4553 |
4559 | 4554 |
4560 bool Heap::IdleNotification(int idle_time_in_ms) { | 4555 bool Heap::IdleNotification(int idle_time_in_ms) { |
4561 return IdleNotification( | 4556 return IdleNotification( |
4562 V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() + | 4557 V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() + |
4563 (static_cast<double>(idle_time_in_ms) / | 4558 (static_cast<double>(idle_time_in_ms) / |
(...skipping 17 matching lines...) Expand all Loading... |
4581 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); | 4576 heap_state.size_of_objects = static_cast<size_t>(SizeOfObjects()); |
4582 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); | 4577 heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); |
4583 // TODO(ulan): Start incremental marking only for large heaps. | 4578 // TODO(ulan): Start incremental marking only for large heaps. |
4584 intptr_t limit = old_generation_allocation_limit_; | 4579 intptr_t limit = old_generation_allocation_limit_; |
4585 if (static_cast<size_t>(idle_time_in_ms) > | 4580 if (static_cast<size_t>(idle_time_in_ms) > |
4586 GCIdleTimeHandler::kMaxFrameRenderingIdleTime) { | 4581 GCIdleTimeHandler::kMaxFrameRenderingIdleTime) { |
4587 limit = idle_old_generation_allocation_limit_; | 4582 limit = idle_old_generation_allocation_limit_; |
4588 } | 4583 } |
4589 | 4584 |
4590 heap_state.can_start_incremental_marking = | 4585 heap_state.can_start_incremental_marking = |
4591 incremental_marking()->WorthActivating() && | 4586 incremental_marking()->CanBeActivated() && |
4592 NextGCIsLikelyToBeFull(limit) && FLAG_incremental_marking && | 4587 HeapIsFullEnoughToStartIncrementalMarking(limit) && |
4593 !mark_compact_collector()->sweeping_in_progress(); | 4588 !mark_compact_collector()->sweeping_in_progress(); |
4594 heap_state.sweeping_in_progress = | 4589 heap_state.sweeping_in_progress = |
4595 mark_compact_collector()->sweeping_in_progress(); | 4590 mark_compact_collector()->sweeping_in_progress(); |
4596 heap_state.sweeping_completed = | 4591 heap_state.sweeping_completed = |
4597 mark_compact_collector()->IsSweepingCompleted(); | 4592 mark_compact_collector()->IsSweepingCompleted(); |
4598 heap_state.mark_compact_speed_in_bytes_per_ms = | 4593 heap_state.mark_compact_speed_in_bytes_per_ms = |
4599 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); | 4594 static_cast<size_t>(tracer()->MarkCompactSpeedInBytesPerMillisecond()); |
4600 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>( | 4595 heap_state.incremental_marking_speed_in_bytes_per_ms = static_cast<size_t>( |
4601 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); | 4596 tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); |
4602 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms = | 4597 heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms = |
(...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6389 static_cast<int>(object_sizes_last_time_[index])); | 6384 static_cast<int>(object_sizes_last_time_[index])); |
6390 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6385 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6391 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6386 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6392 | 6387 |
6393 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6388 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6394 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6389 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6395 ClearObjectStats(); | 6390 ClearObjectStats(); |
6396 } | 6391 } |
6397 } | 6392 } |
6398 } // namespace v8::internal | 6393 } // namespace v8::internal |
OLD | NEW |