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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 | 137 |
138 static inline void MarkBlackOrKeepBlack(HeapObject* heap_object, | 138 static inline void MarkBlackOrKeepBlack(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 (Marking::IsBlack(mark_bit)) return; | 141 if (Marking::IsBlack(mark_bit)) return; |
142 Marking::MarkBlack(mark_bit); | 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 class IncrementalMarkingMarkingVisitor | 147 class IncrementalMarkingMarkingVisitor |
149 : public StaticMarkingVisitor<IncrementalMarkingMarkingVisitor> { | 148 : public StaticMarkingVisitor<IncrementalMarkingMarkingVisitor> { |
150 public: | 149 public: |
151 static void Initialize() { | 150 static void Initialize() { |
152 StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize(); | 151 StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize(); |
153 table_.Register(kVisitFixedArray, &VisitFixedArrayIncremental); | 152 table_.Register(kVisitFixedArray, &VisitFixedArrayIncremental); |
154 table_.Register(kVisitNativeContext, &VisitNativeContextIncremental); | 153 table_.Register(kVisitNativeContext, &VisitNativeContextIncremental); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 INLINE(static void MarkObject(Heap* heap, Object* obj)) { | 243 INLINE(static void MarkObject(Heap* heap, Object* obj)) { |
245 IncrementalMarking::MarkObject(heap, HeapObject::cast(obj)); | 244 IncrementalMarking::MarkObject(heap, HeapObject::cast(obj)); |
246 } | 245 } |
247 | 246 |
248 // Marks the object black without pushing it on the marking stack. | 247 // Marks the object black without pushing it on the marking stack. |
249 // Returns true if object needed marking and false otherwise. | 248 // Returns true if object needed marking and false otherwise. |
250 INLINE(static bool MarkObjectWithoutPush(Heap* heap, Object* obj)) { | 249 INLINE(static bool MarkObjectWithoutPush(Heap* heap, Object* obj)) { |
251 HeapObject* heap_object = HeapObject::cast(obj); | 250 HeapObject* heap_object = HeapObject::cast(obj); |
252 MarkBit mark_bit = Marking::MarkBitFrom(heap_object); | 251 MarkBit mark_bit = Marking::MarkBitFrom(heap_object); |
253 if (Marking::IsWhite(mark_bit)) { | 252 if (Marking::IsWhite(mark_bit)) { |
254 mark_bit.Set(); | 253 Marking::MarkBlack(mark_bit); |
255 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), | 254 MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), |
256 heap_object->Size()); | 255 heap_object->Size()); |
257 return true; | 256 return true; |
258 } | 257 } |
259 return false; | 258 return false; |
260 } | 259 } |
261 }; | 260 }; |
262 | 261 |
263 | 262 |
264 class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { | 263 class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1010 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1012 idle_marking_delay_counter_++; | 1011 idle_marking_delay_counter_++; |
1013 } | 1012 } |
1014 | 1013 |
1015 | 1014 |
1016 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1015 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1017 idle_marking_delay_counter_ = 0; | 1016 idle_marking_delay_counter_ = 0; |
1018 } | 1017 } |
1019 } | 1018 } |
1020 } // namespace v8::internal | 1019 } // namespace v8::internal |
OLD | NEW |