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 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 | 1095 |
1096 if (space_left_is_very_small || | 1096 if (space_left_is_very_small || |
1097 only_1_nth_of_space_that_was_available_still_left) { | 1097 only_1_nth_of_space_that_was_available_still_left) { |
1098 if (FLAG_trace_incremental_marking) | 1098 if (FLAG_trace_incremental_marking) |
1099 heap()->isolate()->PrintWithTimestamp( | 1099 heap()->isolate()->PrintWithTimestamp( |
1100 "[IncrementalMarking] Speed up marking because of low space left\n"); | 1100 "[IncrementalMarking] Speed up marking because of low space left\n"); |
1101 speed_up = true; | 1101 speed_up = true; |
1102 } | 1102 } |
1103 | 1103 |
1104 bool size_of_old_space_multiplied_by_n_during_marking = | 1104 bool size_of_old_space_multiplied_by_n_during_marking = |
1105 (heap_->PromotedSpaceSizeOfObjects() > | 1105 (heap_->PromotedTotalSize() > |
1106 (marking_speed_ + 1) * | 1106 (marking_speed_ + 1) * |
1107 old_generation_space_used_at_start_of_incremental_); | 1107 old_generation_space_used_at_start_of_incremental_); |
1108 if (size_of_old_space_multiplied_by_n_during_marking) { | 1108 if (size_of_old_space_multiplied_by_n_during_marking) { |
1109 speed_up = true; | 1109 speed_up = true; |
1110 if (FLAG_trace_incremental_marking) { | 1110 if (FLAG_trace_incremental_marking) { |
1111 heap()->isolate()->PrintWithTimestamp( | 1111 heap()->isolate()->PrintWithTimestamp( |
1112 "[IncrementalMarking] Speed up marking because of heap size " | 1112 "[IncrementalMarking] Speed up marking because of heap size " |
1113 "increase\n"); | 1113 "increase\n"); |
1114 } | 1114 } |
1115 } | 1115 } |
1116 | 1116 |
1117 int64_t promoted_during_marking = | 1117 int64_t promoted_during_marking = |
1118 heap_->PromotedSpaceSizeOfObjects() - | 1118 heap_->PromotedTotalSize() - |
1119 old_generation_space_used_at_start_of_incremental_; | 1119 old_generation_space_used_at_start_of_incremental_; |
1120 intptr_t delay = marking_speed_ * MB; | 1120 intptr_t delay = marking_speed_ * MB; |
1121 intptr_t scavenge_slack = heap_->MaxSemiSpaceSize(); | 1121 intptr_t scavenge_slack = heap_->MaxSemiSpaceSize(); |
1122 | 1122 |
1123 // We try to scan at at least twice the speed that we are allocating. | 1123 // We try to scan at at least twice the speed that we are allocating. |
1124 if (promoted_during_marking > bytes_scanned_ / 2 + scavenge_slack + delay) { | 1124 if (promoted_during_marking > bytes_scanned_ / 2 + scavenge_slack + delay) { |
1125 if (FLAG_trace_incremental_marking) { | 1125 if (FLAG_trace_incremental_marking) { |
1126 heap()->isolate()->PrintWithTimestamp( | 1126 heap()->isolate()->PrintWithTimestamp( |
1127 "[IncrementalMarking] Speed up marking because marker was not " | 1127 "[IncrementalMarking] Speed up marking because marker was not " |
1128 "keeping up\n"); | 1128 "keeping up\n"); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 duration); | 1283 duration); |
1284 } | 1284 } |
1285 } | 1285 } |
1286 | 1286 |
1287 | 1287 |
1288 void IncrementalMarking::ResetStepCounters() { | 1288 void IncrementalMarking::ResetStepCounters() { |
1289 steps_count_ = 0; | 1289 steps_count_ = 0; |
1290 old_generation_space_available_at_start_of_incremental_ = | 1290 old_generation_space_available_at_start_of_incremental_ = |
1291 SpaceLeftInOldSpace(); | 1291 SpaceLeftInOldSpace(); |
1292 old_generation_space_used_at_start_of_incremental_ = | 1292 old_generation_space_used_at_start_of_incremental_ = |
1293 heap_->PromotedSpaceSizeOfObjects(); | 1293 heap_->PromotedTotalSize(); |
1294 bytes_rescanned_ = 0; | 1294 bytes_rescanned_ = 0; |
1295 marking_speed_ = kInitialMarkingSpeed; | 1295 marking_speed_ = kInitialMarkingSpeed; |
1296 bytes_scanned_ = 0; | 1296 bytes_scanned_ = 0; |
1297 write_barriers_invoked_since_last_step_ = 0; | 1297 write_barriers_invoked_since_last_step_ = 0; |
1298 bytes_marked_ahead_of_schedule_ = 0; | 1298 bytes_marked_ahead_of_schedule_ = 0; |
1299 } | 1299 } |
1300 | 1300 |
1301 | 1301 |
1302 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 1302 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
1303 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); | 1303 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
1304 } | 1304 } |
1305 | 1305 |
1306 | 1306 |
1307 bool IncrementalMarking::IsIdleMarkingDelayCounterLimitReached() { | 1307 bool IncrementalMarking::IsIdleMarkingDelayCounterLimitReached() { |
1308 return idle_marking_delay_counter_ > kMaxIdleMarkingDelayCounter; | 1308 return idle_marking_delay_counter_ > kMaxIdleMarkingDelayCounter; |
1309 } | 1309 } |
1310 | 1310 |
1311 | 1311 |
1312 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1312 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1313 idle_marking_delay_counter_++; | 1313 idle_marking_delay_counter_++; |
1314 } | 1314 } |
1315 | 1315 |
1316 | 1316 |
1317 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1317 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1318 idle_marking_delay_counter_ = 0; | 1318 idle_marking_delay_counter_ = 0; |
1319 } | 1319 } |
1320 | 1320 |
1321 } // namespace internal | 1321 } // namespace internal |
1322 } // namespace v8 | 1322 } // namespace v8 |
OLD | NEW |