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 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 | 13 |
14 bool IncrementalMarking::BaseRecordWrite(HeapObject* obj, Object** slot, | 14 bool IncrementalMarking::BaseRecordWrite(HeapObject* obj, Object** slot, |
15 Object* value) { | 15 Object* value) { |
16 HeapObject* value_heap_obj = HeapObject::cast(value); | 16 HeapObject* value_heap_obj = HeapObject::cast(value); |
17 MarkBit value_bit = Marking::MarkBitFrom(value_heap_obj); | 17 MarkBit value_bit = Marking::MarkBitFrom(value_heap_obj); |
18 // Checking the obj marking state is not necessary, but reduces the marking | 18 if (Marking::IsWhite(value_bit)) { |
19 // load. | 19 MarkBit obj_bit = Marking::MarkBitFrom(obj); |
20 MarkBit obj_bit = Marking::MarkBitFrom(obj); | 20 if (Marking::IsBlack(obj_bit)) { |
21 if (Marking::IsWhite(value_bit) && Marking::IsBlack(obj_bit)) { | 21 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); |
22 WhiteToGreyAndPush(value_heap_obj, value_bit); | 22 if (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR)) { |
23 RestartIfNotMarking(); | 23 if (chunk->IsLeftOfProgressBar(slot)) { |
| 24 WhiteToGreyAndPush(value_heap_obj, value_bit); |
| 25 RestartIfNotMarking(); |
| 26 } else { |
| 27 return false; |
| 28 } |
| 29 } else { |
| 30 BlackToGreyAndUnshift(obj, obj_bit); |
| 31 RestartIfNotMarking(); |
| 32 return false; |
| 33 } |
| 34 } else { |
| 35 return false; |
| 36 } |
24 } | 37 } |
25 if (!is_compacting_) return false; | 38 if (!is_compacting_) return false; |
| 39 MarkBit obj_bit = Marking::MarkBitFrom(obj); |
26 return Marking::IsBlack(obj_bit); | 40 return Marking::IsBlack(obj_bit); |
27 } | 41 } |
28 | 42 |
29 | 43 |
30 void IncrementalMarking::RecordWrite(HeapObject* obj, Object** slot, | 44 void IncrementalMarking::RecordWrite(HeapObject* obj, Object** slot, |
31 Object* value) { | 45 Object* value) { |
32 if (IsMarking() && value->IsHeapObject()) { | 46 if (IsMarking() && value->IsHeapObject()) { |
33 RecordWriteSlow(obj, slot, value); | 47 RecordWriteSlow(obj, slot, value); |
34 } | 48 } |
35 } | 49 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 110 |
97 | 111 |
98 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { | 112 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { |
99 Marking::WhiteToGrey(mark_bit); | 113 Marking::WhiteToGrey(mark_bit); |
100 heap_->mark_compact_collector()->marking_deque()->PushGrey(obj); | 114 heap_->mark_compact_collector()->marking_deque()->PushGrey(obj); |
101 } | 115 } |
102 } | 116 } |
103 } // namespace v8::internal | 117 } // namespace v8::internal |
104 | 118 |
105 #endif // V8_HEAP_INCREMENTAL_MARKING_INL_H_ | 119 #endif // V8_HEAP_INCREMENTAL_MARKING_INL_H_ |
OLD | NEW |