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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/heap/incremental-marking.h" | 7 #include "src/heap/incremental-marking.h" |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 -heap_obj->Size()); | 131 -heap_obj->Size()); |
132 } | 132 } |
133 Marking::AnyToGrey(mark_bit); | 133 Marking::AnyToGrey(mark_bit); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 | 137 |
138 static inline void MarkBlackOrKeepGrey(HeapObject* heap_object, | 138 static inline void MarkBlackOrKeepGrey(HeapObject* heap_object, |
139 MarkBit mark_bit, int size) { | 139 MarkBit mark_bit, int size) { |
140 DCHECK(!Marking::IsImpossible(mark_bit)); | 140 DCHECK(!Marking::IsImpossible(mark_bit)); |
141 if (mark_bit.Get()) return; | 141 if (Marking::IsMarked(mark_bit)) return; |
ulan
2015/03/27 08:36:55
I like IsWhite(), IsBlack() predicates because the
Hannes Payer (out of office)
2015/03/30 15:09:25
Done.
| |
142 mark_bit.Set(); | 142 Marking::MarkBlack(mark_bit); |
143 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), size); | 143 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), size); |
144 DCHECK(Marking::IsBlack(mark_bit)); | |
145 } | 144 } |
146 | 145 |
147 | 146 |
148 static inline void MarkBlackOrKeepBlack(HeapObject* heap_object, | 147 static inline void MarkBlackOrKeepBlack(HeapObject* heap_object, |
149 MarkBit mark_bit, int size) { | 148 MarkBit mark_bit, int size) { |
150 DCHECK(!Marking::IsImpossible(mark_bit)); | 149 DCHECK(!Marking::IsImpossible(mark_bit)); |
151 if (Marking::IsBlack(mark_bit)) return; | 150 if (Marking::IsBlack(mark_bit)) return; |
152 Marking::MarkBlack(mark_bit); | 151 Marking::MarkBlack(mark_bit); |
153 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), size); | 152 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), size); |
154 DCHECK(Marking::IsBlack(mark_bit)); | |
155 } | 153 } |
156 | 154 |
157 | 155 |
158 class IncrementalMarkingMarkingVisitor | 156 class IncrementalMarkingMarkingVisitor |
159 : public StaticMarkingVisitor<IncrementalMarkingMarkingVisitor> { | 157 : public StaticMarkingVisitor<IncrementalMarkingMarkingVisitor> { |
160 public: | 158 public: |
161 static void Initialize() { | 159 static void Initialize() { |
162 StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize(); | 160 StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize(); |
163 table_.Register(kVisitFixedArray, &VisitFixedArrayIncremental); | 161 table_.Register(kVisitFixedArray, &VisitFixedArrayIncremental); |
164 table_.Register(kVisitNativeContext, &VisitNativeContextIncremental); | 162 table_.Register(kVisitNativeContext, &VisitNativeContextIncremental); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 INLINE(static void MarkObject(Heap* heap, Object* obj)) { | 252 INLINE(static void MarkObject(Heap* heap, Object* obj)) { |
255 IncrementalMarking::MarkObject(heap, HeapObject::cast(obj)); | 253 IncrementalMarking::MarkObject(heap, HeapObject::cast(obj)); |
256 } | 254 } |
257 | 255 |
258 // Marks the object black without pushing it on the marking stack. | 256 // Marks the object black without pushing it on the marking stack. |
259 // Returns true if object needed marking and false otherwise. | 257 // Returns true if object needed marking and false otherwise. |
260 INLINE(static bool MarkObjectWithoutPush(Heap* heap, Object* obj)) { | 258 INLINE(static bool MarkObjectWithoutPush(Heap* heap, Object* obj)) { |
261 HeapObject* heap_object = HeapObject::cast(obj); | 259 HeapObject* heap_object = HeapObject::cast(obj); |
262 MarkBit mark_bit = Marking::MarkBitFrom(heap_object); | 260 MarkBit mark_bit = Marking::MarkBitFrom(heap_object); |
263 if (Marking::IsWhite(mark_bit)) { | 261 if (Marking::IsWhite(mark_bit)) { |
264 mark_bit.Set(); | 262 Marking::MarkBlack(mark_bit); |
265 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), | 263 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), |
266 heap_object->Size()); | 264 heap_object->Size()); |
267 return true; | 265 return true; |
268 } | 266 } |
269 return false; | 267 return false; |
270 } | 268 } |
271 }; | 269 }; |
272 | 270 |
273 | 271 |
274 class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { | 272 class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1025 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1023 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1026 idle_marking_delay_counter_++; | 1024 idle_marking_delay_counter_++; |
1027 } | 1025 } |
1028 | 1026 |
1029 | 1027 |
1030 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1028 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1031 idle_marking_delay_counter_ = 0; | 1029 idle_marking_delay_counter_ = 0; |
1032 } | 1030 } |
1033 } | 1031 } |
1034 } // namespace v8::internal | 1032 } // namespace v8::internal |
OLD | NEW |