| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include "execution.h" | 32 #include "execution.h" |
| 33 #include "mark-compact.h" | 33 #include "mark-compact.h" |
| 34 #include "objects.h" | 34 #include "objects.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 | 39 |
| 40 // TODO(gc) rename into IncrementalMarker after merge. | 40 // TODO(gc) rename into IncrementalMarker after merge. |
| 41 class IncrementalMarking : public AllStatic { | 41 class IncrementalMarking { |
| 42 public: | 42 public: |
| 43 enum State { | 43 enum State { |
| 44 STOPPED, | 44 STOPPED, |
| 45 SWEEPING, | 45 SWEEPING, |
| 46 MARKING, | 46 MARKING, |
| 47 COMPLETE | 47 COMPLETE |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 explicit IncrementalMarking(Heap* heap); | 50 explicit IncrementalMarking(Heap* heap); |
| 51 | 51 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 inline double steps_took() { | 136 inline double steps_took() { |
| 137 return steps_took_; | 137 return steps_took_; |
| 138 } | 138 } |
| 139 | 139 |
| 140 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { | 140 inline void SetOldSpacePageFlags(MemoryChunk* chunk) { |
| 141 SetOldSpacePageFlags(chunk, IsMarking()); | 141 SetOldSpacePageFlags(chunk, IsMarking()); |
| 142 } | 142 } |
| 143 | 143 |
| 144 inline void SetNewSpacePageFlags(MemoryChunk* chunk) { | 144 inline void SetNewSpacePageFlags(NewSpacePage* chunk) { |
| 145 SetNewSpacePageFlags(chunk, IsMarking()); | 145 SetNewSpacePageFlags(chunk, IsMarking()); |
| 146 } | 146 } |
| 147 | 147 |
| 148 MarkingDeque* marking_deque() { return &marking_deque_; } | 148 MarkingDeque* marking_deque() { return &marking_deque_; } |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 void set_should_hurry(bool val) { | 151 void set_should_hurry(bool val) { |
| 152 should_hurry_ = val; | 152 should_hurry_ = val; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void ResetStepCounters() { | 155 void ResetStepCounters() { |
| 156 steps_count_ = 0; | 156 steps_count_ = 0; |
| 157 steps_took_ = 0; | 157 steps_took_ = 0; |
| 158 allocation_marking_factor_ = kInitialAllocationMarkingFactor; | 158 allocation_marking_factor_ = kInitialAllocationMarkingFactor; |
| 159 } | 159 } |
| 160 | 160 |
| 161 static void ClearMarkbits(PagedSpace* space); | 161 static void ClearMarkbits(PagedSpace* space); |
| 162 static void ClearMarkbits(NewSpace* space); |
| 162 void ClearMarkbits(); | 163 void ClearMarkbits(); |
| 163 | 164 |
| 164 #ifdef DEBUG | 165 #ifdef DEBUG |
| 165 void VerifyMarkbitsAreClean(); | 166 void VerifyMarkbitsAreClean(); |
| 166 static void VerifyMarkbitsAreClean(PagedSpace* space); | 167 static void VerifyMarkbitsAreClean(PagedSpace* space); |
| 168 static void VerifyMarkbitsAreClean(NewSpace* space); |
| 167 #endif | 169 #endif |
| 168 | 170 |
| 169 void StartMarking(); | 171 void StartMarking(); |
| 170 | 172 |
| 171 void DeactivateWriteBarrierForSpace(PagedSpace* space); | 173 void DeactivateIncrementalWriteBarrierForSpace(PagedSpace* space); |
| 172 void DeactivateWriteBarrier(); | 174 void DeactivateIncrementalWriteBarrierForSpace(NewSpace* space); |
| 175 void DeactivateIncrementalWriteBarrier(); |
| 173 | 176 |
| 174 static void SetOldSpacePageFlags(MemoryChunk* chunk, bool is_marking); | 177 static void SetOldSpacePageFlags(MemoryChunk* chunk, bool is_marking); |
| 175 static void SetNewSpacePageFlags(MemoryChunk* chunk, bool is_marking); | 178 static void SetNewSpacePageFlags(NewSpacePage* chunk, bool is_marking); |
| 176 | 179 |
| 177 void EnsureMarkingDequeIsCommitted(); | 180 void EnsureMarkingDequeIsCommitted(); |
| 178 | 181 |
| 179 Heap* heap_; | 182 Heap* heap_; |
| 180 | 183 |
| 181 State state_; | 184 State state_; |
| 182 | 185 |
| 183 VirtualMemory* marking_deque_memory_; | 186 VirtualMemory* marking_deque_memory_; |
| 184 MarkingDeque marking_deque_; | 187 MarkingDeque marking_deque_; |
| 185 | 188 |
| 186 int steps_count_; | 189 int steps_count_; |
| 187 double steps_took_; | 190 double steps_took_; |
| 188 bool should_hurry_; | 191 bool should_hurry_; |
| 189 int allocation_marking_factor_; | 192 int allocation_marking_factor_; |
| 190 intptr_t allocated_; | 193 intptr_t allocated_; |
| 191 }; | 194 }; |
| 192 | 195 |
| 193 } } // namespace v8::internal | 196 } } // namespace v8::internal |
| 194 | 197 |
| 195 #endif // V8_INCREMENTAL_MARKING_H_ | 198 #endif // V8_INCREMENTAL_MARKING_H_ |
| OLD | NEW |