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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 59 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
60 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 60 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
61 if (!mark_bit.Get()) { | 61 if (!mark_bit.Get()) { |
62 mark_bit.Set(); | 62 mark_bit.Set(); |
63 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); | 63 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); |
64 ProcessNewlyMarkedObject(obj); | 64 ProcessNewlyMarkedObject(obj); |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 | 68 |
| 69 bool MarkCompactCollector::MarkObjectWithoutPush(HeapObject* object) { |
| 70 MarkBit mark = Marking::MarkBitFrom(object); |
| 71 bool old_mark = mark.Get(); |
| 72 if (!old_mark) SetMark(object, mark); |
| 73 return old_mark; |
| 74 } |
| 75 |
| 76 |
| 77 void MarkCompactCollector::MarkObjectAndPush(HeapObject* object) { |
| 78 if (!MarkObjectWithoutPush(object)) marking_deque_.PushBlack(object); |
| 79 } |
| 80 |
| 81 |
69 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { | 82 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { |
70 ASSERT(!mark_bit.Get()); | 83 ASSERT(!mark_bit.Get()); |
71 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 84 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
72 mark_bit.Set(); | 85 mark_bit.Set(); |
73 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); | 86 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); |
74 if (obj->IsMap()) { | 87 if (obj->IsMap()) { |
75 ClearCacheOnMap(Map::cast(obj)); | 88 ClearCacheOnMap(Map::cast(obj)); |
76 } | 89 } |
77 } | 90 } |
78 | 91 |
(...skipping 17 matching lines...) Expand all Loading... |
96 SlotsBuffer::FAIL_ON_OVERFLOW)) { | 109 SlotsBuffer::FAIL_ON_OVERFLOW)) { |
97 EvictEvacuationCandidate(object_page); | 110 EvictEvacuationCandidate(object_page); |
98 } | 111 } |
99 } | 112 } |
100 } | 113 } |
101 | 114 |
102 | 115 |
103 } } // namespace v8::internal | 116 } } // namespace v8::internal |
104 | 117 |
105 #endif // V8_MARK_COMPACT_INL_H_ | 118 #endif // V8_MARK_COMPACT_INL_H_ |
OLD | NEW |