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_INL_H_ | 5 #ifndef V8_HEAP_INCREMENTAL_MARKING_INL_H_ |
6 #define V8_HEAP_INCREMENTAL_MARKING_INL_H_ | 6 #define V8_HEAP_INCREMENTAL_MARKING_INL_H_ |
7 | 7 |
8 #include "src/heap/incremental-marking.h" | 8 #include "src/heap/incremental-marking.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 | 80 |
81 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj, | 81 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj, |
82 MarkBit mark_bit) { | 82 MarkBit mark_bit) { |
83 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); | 83 DCHECK(Marking::MarkBitFrom(obj) == mark_bit); |
84 DCHECK(obj->Size() >= 2 * kPointerSize); | 84 DCHECK(obj->Size() >= 2 * kPointerSize); |
85 DCHECK(IsMarking()); | 85 DCHECK(IsMarking()); |
86 Marking::BlackToGrey(mark_bit); | 86 Marking::BlackToGrey(mark_bit); |
87 int obj_size = obj->Size(); | 87 int obj_size = obj->Size(); |
88 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), -obj_size); | 88 MemoryChunk::IncrementLiveBytesFromGC(obj, -obj_size); |
89 bytes_scanned_ -= obj_size; | 89 bytes_scanned_ -= obj_size; |
90 int64_t old_bytes_rescanned = bytes_rescanned_; | 90 int64_t old_bytes_rescanned = bytes_rescanned_; |
91 bytes_rescanned_ = old_bytes_rescanned + obj_size; | 91 bytes_rescanned_ = old_bytes_rescanned + obj_size; |
92 if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) { | 92 if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) { |
93 if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSizeOfObjects()) { | 93 if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSizeOfObjects()) { |
94 // If we have queued twice the heap size for rescanning then we are | 94 // If we have queued twice the heap size for rescanning then we are |
95 // going around in circles, scanning the same objects again and again | 95 // going around in circles, scanning the same objects again and again |
96 // as the program mutates the heap faster than we can incrementally | 96 // as the program mutates the heap faster than we can incrementally |
97 // trace it. In this case we switch to non-incremental marking in | 97 // trace it. In this case we switch to non-incremental marking in |
98 // order to finish off this marking phase. | 98 // order to finish off this marking phase. |
(...skipping 11 matching lines...) Expand all Loading... |
110 | 110 |
111 | 111 |
112 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { | 112 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { |
113 Marking::WhiteToGrey(mark_bit); | 113 Marking::WhiteToGrey(mark_bit); |
114 heap_->mark_compact_collector()->marking_deque()->PushGrey(obj); | 114 heap_->mark_compact_collector()->marking_deque()->PushGrey(obj); |
115 } | 115 } |
116 } | 116 } |
117 } // namespace v8::internal | 117 } // namespace v8::internal |
118 | 118 |
119 #endif // V8_HEAP_INCREMENTAL_MARKING_INL_H_ | 119 #endif // V8_HEAP_INCREMENTAL_MARKING_INL_H_ |
OLD | NEW |