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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 787 |
788 VisitObject(map, obj, obj->SizeFromMap(map)); | 788 VisitObject(map, obj, obj->SizeFromMap(map)); |
789 } | 789 } |
790 } | 790 } |
791 | 791 |
792 | 792 |
793 void IncrementalMarking::Hurry() { | 793 void IncrementalMarking::Hurry() { |
794 if (state() == MARKING) { | 794 if (state() == MARKING) { |
795 double start = 0.0; | 795 double start = 0.0; |
796 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) { | 796 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) { |
797 start = base::OS::TimeCurrentMillis(); | 797 start = heap_->MonotonicallyIncreasingTimeInMs(); |
798 if (FLAG_trace_incremental_marking) { | 798 if (FLAG_trace_incremental_marking) { |
799 PrintF("[IncrementalMarking] Hurry\n"); | 799 PrintF("[IncrementalMarking] Hurry\n"); |
800 } | 800 } |
801 } | 801 } |
802 // TODO(gc) hurry can mark objects it encounters black as mutator | 802 // TODO(gc) hurry can mark objects it encounters black as mutator |
803 // was stopped. | 803 // was stopped. |
804 ProcessMarkingDeque(); | 804 ProcessMarkingDeque(); |
805 state_ = COMPLETE; | 805 state_ = COMPLETE; |
806 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) { | 806 if (FLAG_trace_incremental_marking || FLAG_print_cumulative_gc_stat) { |
807 double end = base::OS::TimeCurrentMillis(); | 807 double end = heap_->MonotonicallyIncreasingTimeInMs(); |
808 double delta = end - start; | 808 double delta = end - start; |
809 heap_->tracer()->AddMarkingTime(delta); | 809 heap_->tracer()->AddMarkingTime(delta); |
810 if (FLAG_trace_incremental_marking) { | 810 if (FLAG_trace_incremental_marking) { |
811 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", | 811 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", |
812 static_cast<int>(delta)); | 812 static_cast<int>(delta)); |
813 } | 813 } |
814 } | 814 } |
815 } | 815 } |
816 | 816 |
817 if (FLAG_cleanup_code_caches_at_gc) { | 817 if (FLAG_cleanup_code_caches_at_gc) { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 heap_->RecentIdleNotificationHappened()) { | 1059 heap_->RecentIdleNotificationHappened()) { |
1060 return 0; | 1060 return 0; |
1061 } | 1061 } |
1062 | 1062 |
1063 if (state_ == MARKING && no_marking_scope_depth_ > 0) return 0; | 1063 if (state_ == MARKING && no_marking_scope_depth_ > 0) return 0; |
1064 | 1064 |
1065 intptr_t bytes_processed = 0; | 1065 intptr_t bytes_processed = 0; |
1066 { | 1066 { |
1067 HistogramTimerScope incremental_marking_scope( | 1067 HistogramTimerScope incremental_marking_scope( |
1068 heap_->isolate()->counters()->gc_incremental_marking()); | 1068 heap_->isolate()->counters()->gc_incremental_marking()); |
1069 double start = base::OS::TimeCurrentMillis(); | 1069 double start = heap_->MonotonicallyIncreasingTimeInMs(); |
1070 | 1070 |
1071 // The marking speed is driven either by the allocation rate or by the rate | 1071 // The marking speed is driven either by the allocation rate or by the rate |
1072 // at which we are having to check the color of objects in the write | 1072 // at which we are having to check the color of objects in the write |
1073 // barrier. | 1073 // barrier. |
1074 // It is possible for a tight non-allocating loop to run a lot of write | 1074 // It is possible for a tight non-allocating loop to run a lot of write |
1075 // barriers before we get here and check them (marking can only take place | 1075 // barriers before we get here and check them (marking can only take place |
1076 // on | 1076 // on |
1077 // allocation), so to reduce the lumpiness we don't use the write barriers | 1077 // allocation), so to reduce the lumpiness we don't use the write barriers |
1078 // invoked since last step directly to determine the amount of work to do. | 1078 // invoked since last step directly to determine the amount of work to do. |
1079 intptr_t bytes_to_process = | 1079 intptr_t bytes_to_process = |
(...skipping 30 matching lines...) Expand all Loading... |
1110 } | 1110 } |
1111 } | 1111 } |
1112 } | 1112 } |
1113 | 1113 |
1114 steps_count_++; | 1114 steps_count_++; |
1115 | 1115 |
1116 // Speed up marking if we are marking too slow or if we are almost done | 1116 // Speed up marking if we are marking too slow or if we are almost done |
1117 // with marking. | 1117 // with marking. |
1118 SpeedUp(); | 1118 SpeedUp(); |
1119 | 1119 |
1120 double end = base::OS::TimeCurrentMillis(); | 1120 double end = heap_->MonotonicallyIncreasingTimeInMs(); |
1121 double duration = (end - start); | 1121 double duration = (end - start); |
1122 // Note that we report zero bytes here when sweeping was in progress or | 1122 // Note that we report zero bytes here when sweeping was in progress or |
1123 // when we just started incremental marking. In these cases we did not | 1123 // when we just started incremental marking. In these cases we did not |
1124 // process the marking deque. | 1124 // process the marking deque. |
1125 heap_->tracer()->AddIncrementalMarkingStep(duration, bytes_processed); | 1125 heap_->tracer()->AddIncrementalMarkingStep(duration, bytes_processed); |
1126 } | 1126 } |
1127 return bytes_processed; | 1127 return bytes_processed; |
1128 } | 1128 } |
1129 | 1129 |
1130 | 1130 |
(...skipping 23 matching lines...) Expand all Loading... |
1154 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1154 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1155 idle_marking_delay_counter_++; | 1155 idle_marking_delay_counter_++; |
1156 } | 1156 } |
1157 | 1157 |
1158 | 1158 |
1159 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1159 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1160 idle_marking_delay_counter_ = 0; | 1160 idle_marking_delay_counter_ = 0; |
1161 } | 1161 } |
1162 } // namespace internal | 1162 } // namespace internal |
1163 } // namespace v8 | 1163 } // namespace v8 |
OLD | NEW |