| 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 #ifndef V8_HEAP_INCREMENTAL_MARKING_H_ | 5 #ifndef V8_HEAP_INCREMENTAL_MARKING_H_ |
| 6 #define V8_HEAP_INCREMENTAL_MARKING_H_ | 6 #define V8_HEAP_INCREMENTAL_MARKING_H_ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "src/execution.h" | 9 #include "src/execution.h" |
| 10 #include "src/heap/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 static const intptr_t kInitialMarkingSpeed = 1; | 76 static const intptr_t kInitialMarkingSpeed = 1; |
| 77 // But if we are promoting a lot of data we need to mark faster to keep up | 77 // But if we are promoting a lot of data we need to mark faster to keep up |
| 78 // with the data that is entering the old space through promotion. | 78 // with the data that is entering the old space through promotion. |
| 79 static const intptr_t kFastMarking = 3; | 79 static const intptr_t kFastMarking = 3; |
| 80 // After this many steps we increase the marking/allocating factor. | 80 // After this many steps we increase the marking/allocating factor. |
| 81 static const intptr_t kMarkingSpeedAccellerationInterval = 1024; | 81 static const intptr_t kMarkingSpeedAccellerationInterval = 1024; |
| 82 // This is how much we increase the marking/allocating factor by. | 82 // This is how much we increase the marking/allocating factor by. |
| 83 static const intptr_t kMarkingSpeedAccelleration = 2; | 83 static const intptr_t kMarkingSpeedAccelleration = 2; |
| 84 static const intptr_t kMaxMarkingSpeed = 1000; | 84 static const intptr_t kMaxMarkingSpeed = 1000; |
| 85 | 85 |
| 86 // This is the upper bound for how many times we allow finalization of |
| 87 // incremental marking to be postponed. |
| 88 static const size_t kMaxIdleMarkingDelayCounter = 3; |
| 89 |
| 86 void OldSpaceStep(intptr_t allocated); | 90 void OldSpaceStep(intptr_t allocated); |
| 87 | 91 |
| 88 void Step(intptr_t allocated, CompletionAction action, | 92 void Step(intptr_t allocated, CompletionAction action, |
| 89 bool force_marking = false); | 93 bool force_marking = false, bool force_completion = true); |
| 90 | 94 |
| 91 inline void RestartIfNotMarking() { | 95 inline void RestartIfNotMarking() { |
| 92 if (state_ == COMPLETE) { | 96 if (state_ == COMPLETE) { |
| 93 state_ = MARKING; | 97 state_ = MARKING; |
| 94 if (FLAG_trace_incremental_marking) { | 98 if (FLAG_trace_incremental_marking) { |
| 95 PrintF("[IncrementalMarking] Restarting (new grey objects)\n"); | 99 PrintF("[IncrementalMarking] Restarting (new grey objects)\n"); |
| 96 } | 100 } |
| 97 } | 101 } |
| 98 } | 102 } |
| 99 | 103 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 void EnterNoMarkingScope() { no_marking_scope_depth_++; } | 162 void EnterNoMarkingScope() { no_marking_scope_depth_++; } |
| 159 | 163 |
| 160 void LeaveNoMarkingScope() { no_marking_scope_depth_--; } | 164 void LeaveNoMarkingScope() { no_marking_scope_depth_--; } |
| 161 | 165 |
| 162 void UncommitMarkingDeque(); | 166 void UncommitMarkingDeque(); |
| 163 | 167 |
| 164 void NotifyIncompleteScanOfObject(int unscanned_bytes) { | 168 void NotifyIncompleteScanOfObject(int unscanned_bytes) { |
| 165 unscanned_bytes_of_large_object_ = unscanned_bytes; | 169 unscanned_bytes_of_large_object_ = unscanned_bytes; |
| 166 } | 170 } |
| 167 | 171 |
| 172 void ClearIdleMarkingDelayCounter(); |
| 173 |
| 168 private: | 174 private: |
| 169 int64_t SpaceLeftInOldSpace(); | 175 int64_t SpaceLeftInOldSpace(); |
| 170 | 176 |
| 171 void SpeedUp(); | 177 void SpeedUp(); |
| 172 | 178 |
| 173 void ResetStepCounters(); | 179 void ResetStepCounters(); |
| 174 | 180 |
| 175 void StartMarking(CompactionFlag flag); | 181 void StartMarking(CompactionFlag flag); |
| 176 | 182 |
| 177 void ActivateIncrementalWriteBarrier(PagedSpace* space); | 183 void ActivateIncrementalWriteBarrier(PagedSpace* space); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 188 static void SetNewSpacePageFlags(NewSpacePage* chunk, bool is_marking); | 194 static void SetNewSpacePageFlags(NewSpacePage* chunk, bool is_marking); |
| 189 | 195 |
| 190 void EnsureMarkingDequeIsCommitted(); | 196 void EnsureMarkingDequeIsCommitted(); |
| 191 | 197 |
| 192 INLINE(void ProcessMarkingDeque()); | 198 INLINE(void ProcessMarkingDeque()); |
| 193 | 199 |
| 194 INLINE(intptr_t ProcessMarkingDeque(intptr_t bytes_to_process)); | 200 INLINE(intptr_t ProcessMarkingDeque(intptr_t bytes_to_process)); |
| 195 | 201 |
| 196 INLINE(void VisitObject(Map* map, HeapObject* obj, int size)); | 202 INLINE(void VisitObject(Map* map, HeapObject* obj, int size)); |
| 197 | 203 |
| 204 bool IsIdleMarkingDelayCounterLimitReached(); |
| 205 |
| 206 void IncrementIdleMarkingDelayCounter(); |
| 207 |
| 198 Heap* heap_; | 208 Heap* heap_; |
| 199 | 209 |
| 200 State state_; | 210 State state_; |
| 201 bool is_compacting_; | 211 bool is_compacting_; |
| 202 | 212 |
| 203 base::VirtualMemory* marking_deque_memory_; | 213 base::VirtualMemory* marking_deque_memory_; |
| 204 bool marking_deque_memory_committed_; | 214 bool marking_deque_memory_committed_; |
| 205 MarkingDeque marking_deque_; | 215 MarkingDeque marking_deque_; |
| 206 | 216 |
| 207 int steps_count_; | 217 int steps_count_; |
| 208 int64_t old_generation_space_available_at_start_of_incremental_; | 218 int64_t old_generation_space_available_at_start_of_incremental_; |
| 209 int64_t old_generation_space_used_at_start_of_incremental_; | 219 int64_t old_generation_space_used_at_start_of_incremental_; |
| 210 int64_t bytes_rescanned_; | 220 int64_t bytes_rescanned_; |
| 211 bool should_hurry_; | 221 bool should_hurry_; |
| 212 int marking_speed_; | 222 int marking_speed_; |
| 213 intptr_t bytes_scanned_; | 223 intptr_t bytes_scanned_; |
| 214 intptr_t allocated_; | 224 intptr_t allocated_; |
| 215 intptr_t write_barriers_invoked_since_last_step_; | 225 intptr_t write_barriers_invoked_since_last_step_; |
| 226 size_t idle_marking_delay_counter_; |
| 216 | 227 |
| 217 int no_marking_scope_depth_; | 228 int no_marking_scope_depth_; |
| 218 | 229 |
| 219 int unscanned_bytes_of_large_object_; | 230 int unscanned_bytes_of_large_object_; |
| 220 | 231 |
| 221 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); | 232 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); |
| 222 }; | 233 }; |
| 223 } | 234 } |
| 224 } // namespace v8::internal | 235 } // namespace v8::internal |
| 225 | 236 |
| 226 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ | 237 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ |
| OLD | NEW |