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/heap/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/heap/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 | 794 |
795 int marking_progress = | 795 int marking_progress = |
796 abs(old_marking_deque_top - | 796 abs(old_marking_deque_top - |
797 heap_->mark_compact_collector()->marking_deque()->top()); | 797 heap_->mark_compact_collector()->marking_deque()->top()); |
798 | 798 |
799 marking_progress += | 799 marking_progress += |
800 static_cast<int>(heap_->mark_compact_collector()->wrappers_to_trace()); | 800 static_cast<int>(heap_->mark_compact_collector()->wrappers_to_trace()); |
801 | 801 |
802 double end = heap_->MonotonicallyIncreasingTimeInMs(); | 802 double end = heap_->MonotonicallyIncreasingTimeInMs(); |
803 double delta = end - start; | 803 double delta = end - start; |
804 heap_->tracer()->AddMarkingTime(delta); | |
805 if (FLAG_trace_incremental_marking) { | 804 if (FLAG_trace_incremental_marking) { |
806 heap()->isolate()->PrintWithTimestamp( | 805 heap()->isolate()->PrintWithTimestamp( |
807 "[IncrementalMarking] Finalize incrementally round %d, " | 806 "[IncrementalMarking] Finalize incrementally round %d, " |
808 "spent %d ms, marking progress %d.\n", | 807 "spent %d ms, marking progress %d.\n", |
809 static_cast<int>(delta), incremental_marking_finalization_rounds_, | 808 static_cast<int>(delta), incremental_marking_finalization_rounds_, |
810 marking_progress); | 809 marking_progress); |
811 } | 810 } |
812 | 811 |
813 ++incremental_marking_finalization_rounds_; | 812 ++incremental_marking_finalization_rounds_; |
814 if ((incremental_marking_finalization_rounds_ >= | 813 if ((incremental_marking_finalization_rounds_ >= |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 | 942 |
944 | 943 |
945 void IncrementalMarking::Hurry() { | 944 void IncrementalMarking::Hurry() { |
946 // A scavenge may have pushed new objects on the marking deque (due to black | 945 // A scavenge may have pushed new objects on the marking deque (due to black |
947 // allocation) even in COMPLETE state. This may happen if scavenges are | 946 // allocation) even in COMPLETE state. This may happen if scavenges are |
948 // forced e.g. in tests. It should not happen when COMPLETE was set when | 947 // forced e.g. in tests. It should not happen when COMPLETE was set when |
949 // incremental marking finished and a regular GC was triggered after that | 948 // incremental marking finished and a regular GC was triggered after that |
950 // because should_hurry_ will force a full GC. | 949 // because should_hurry_ will force a full GC. |
951 if (!heap_->mark_compact_collector()->marking_deque()->IsEmpty()) { | 950 if (!heap_->mark_compact_collector()->marking_deque()->IsEmpty()) { |
952 double start = 0.0; | 951 double start = 0.0; |
953 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) { | 952 if (FLAG_trace_incremental_marking) { |
954 start = heap_->MonotonicallyIncreasingTimeInMs(); | 953 start = heap_->MonotonicallyIncreasingTimeInMs(); |
955 if (FLAG_trace_incremental_marking) { | 954 if (FLAG_trace_incremental_marking) { |
956 heap()->isolate()->PrintWithTimestamp("[IncrementalMarking] Hurry\n"); | 955 heap()->isolate()->PrintWithTimestamp("[IncrementalMarking] Hurry\n"); |
957 } | 956 } |
958 } | 957 } |
959 // TODO(gc) hurry can mark objects it encounters black as mutator | 958 // TODO(gc) hurry can mark objects it encounters black as mutator |
960 // was stopped. | 959 // was stopped. |
961 ProcessMarkingDeque(0, FORCE_COMPLETION); | 960 ProcessMarkingDeque(0, FORCE_COMPLETION); |
962 state_ = COMPLETE; | 961 state_ = COMPLETE; |
963 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) { | 962 if (FLAG_trace_incremental_marking) { |
964 double end = heap_->MonotonicallyIncreasingTimeInMs(); | 963 double end = heap_->MonotonicallyIncreasingTimeInMs(); |
965 double delta = end - start; | 964 double delta = end - start; |
966 heap_->tracer()->AddMarkingTime(delta); | |
967 if (FLAG_trace_incremental_marking) { | 965 if (FLAG_trace_incremental_marking) { |
968 heap()->isolate()->PrintWithTimestamp( | 966 heap()->isolate()->PrintWithTimestamp( |
969 "[IncrementalMarking] Complete (hurry), spent %d ms.\n", | 967 "[IncrementalMarking] Complete (hurry), spent %d ms.\n", |
970 static_cast<int>(delta)); | 968 static_cast<int>(delta)); |
971 } | 969 } |
972 } | 970 } |
973 } | 971 } |
974 | 972 |
975 Object* context = heap_->native_contexts_list(); | 973 Object* context = heap_->native_contexts_list(); |
976 while (!context->IsUndefined(heap_->isolate())) { | 974 while (!context->IsUndefined(heap_->isolate())) { |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 idle_marking_delay_counter_++; | 1321 idle_marking_delay_counter_++; |
1324 } | 1322 } |
1325 | 1323 |
1326 | 1324 |
1327 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1325 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1328 idle_marking_delay_counter_ = 0; | 1326 idle_marking_delay_counter_ = 0; |
1329 } | 1327 } |
1330 | 1328 |
1331 } // namespace internal | 1329 } // namespace internal |
1332 } // namespace v8 | 1330 } // namespace v8 |
OLD | NEW |