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 16 matching lines...) Expand all Loading... | |
27 | 27 |
28 #ifndef V8_INCREMENTAL_MARKING_INL_H_ | 28 #ifndef V8_INCREMENTAL_MARKING_INL_H_ |
29 #define V8_INCREMENTAL_MARKING_INL_H_ | 29 #define V8_INCREMENTAL_MARKING_INL_H_ |
30 | 30 |
31 #include "incremental-marking.h" | 31 #include "incremental-marking.h" |
32 | 32 |
33 namespace v8 { | 33 namespace v8 { |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 | 36 |
37 void IncrementalMarking::RecordWrite(HeapObject* obj, Object* value) { | 37 void IncrementalMarking::RecordWrite(HeapObject* obj, |
38 Object** slot, | |
39 Object* value) { | |
38 if (IsMarking() && value->IsHeapObject()) { | 40 if (IsMarking() && value->IsHeapObject()) { |
39 MarkBit value_bit = Marking::MarkBitFrom(HeapObject::cast(value)); | 41 MarkBit value_bit = Marking::MarkBitFrom(HeapObject::cast(value)); |
40 if (Marking::IsWhite(value_bit)) { | 42 if (Marking::IsWhite(value_bit)) { |
41 MarkBit obj_bit = Marking::MarkBitFrom(obj); | 43 MarkBit obj_bit = Marking::MarkBitFrom(obj); |
42 if (Marking::IsBlack(obj_bit)) { | 44 if (Marking::IsBlack(obj_bit)) { |
43 BlackToGreyAndUnshift(obj, obj_bit); | 45 BlackToGreyAndUnshift(obj, obj_bit); |
44 RestartIfNotMarking(); | 46 RestartIfNotMarking(); |
45 } | 47 } |
48 | |
49 // Object is either grey or white it will be scanned if survives. | |
50 return; | |
51 } | |
52 | |
53 if (is_compacting_ && slot != NULL) { | |
54 MarkBit obj_bit = Marking::MarkBitFrom(obj); | |
55 if (Marking::IsBlack(obj_bit)) { | |
56 // Object is not going to be rescaned we need to record slot. | |
Erik Corry
2011/07/04 11:04:11
rescaned -> rescanned,
slot -> the slot
Vyacheslav Egorov (Chromium)
2011/08/05 12:50:28
Done.
| |
57 heap_->mark_compact_collector()->RecordSlot( | |
58 HeapObject::RawField(obj, 0), slot, value); | |
59 } | |
46 } | 60 } |
47 } | 61 } |
48 } | 62 } |
49 | 63 |
50 | 64 |
51 void IncrementalMarking::RecordWriteOf(HeapObject* value) { | 65 void IncrementalMarking::RecordWriteOf(HeapObject* value) { |
52 if (IsMarking()) { | 66 if (IsMarking()) { |
67 ASSERT(!MarkCompactCollector::IsOnEvacuationCandidate(value)); | |
68 | |
53 MarkBit value_bit = Marking::MarkBitFrom(value); | 69 MarkBit value_bit = Marking::MarkBitFrom(value); |
54 if (Marking::IsWhite(value_bit)) { | 70 if (Marking::IsWhite(value_bit)) { |
55 WhiteToGreyAndPush(value, value_bit); | 71 WhiteToGreyAndPush(value, value_bit); |
56 RestartIfNotMarking(); | 72 RestartIfNotMarking(); |
57 } | 73 } |
58 } | 74 } |
59 } | 75 } |
60 | 76 |
61 | 77 |
62 void IncrementalMarking::RecordWrites(HeapObject* obj) { | 78 void IncrementalMarking::RecordWrites(HeapObject* obj) { |
(...skipping 28 matching lines...) Expand all Loading... | |
91 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 107 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
92 ASSERT(obj->Size() >= 2*kPointerSize); | 108 ASSERT(obj->Size() >= 2*kPointerSize); |
93 ASSERT(IsMarking()); | 109 ASSERT(IsMarking()); |
94 Marking::WhiteToGrey(mark_bit); | 110 Marking::WhiteToGrey(mark_bit); |
95 } | 111 } |
96 | 112 |
97 | 113 |
98 } } // namespace v8::internal | 114 } } // namespace v8::internal |
99 | 115 |
100 #endif // V8_INCREMENTAL_MARKING_INL_H_ | 116 #endif // V8_INCREMENTAL_MARKING_INL_H_ |
OLD | NEW |