OLD | NEW |
1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 | 46 |
47 void MarkCompactCollector::SetFlags(int flags) { | 47 void MarkCompactCollector::SetFlags(int flags) { |
48 sweep_precisely_ = ((flags & Heap::kSweepPreciselyMask) != 0); | 48 sweep_precisely_ = ((flags & Heap::kSweepPreciselyMask) != 0); |
49 reduce_memory_footprint_ = ((flags & Heap::kReduceMemoryFootprintMask) != 0); | 49 reduce_memory_footprint_ = ((flags & Heap::kReduceMemoryFootprintMask) != 0); |
50 abort_incremental_marking_ = | 50 abort_incremental_marking_ = |
51 ((flags & Heap::kAbortIncrementalMarkingMask) != 0); | 51 ((flags & Heap::kAbortIncrementalMarkingMask) != 0); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 bool MarkCompactCollector::MarkObjectAndPush(HeapObject* obj) { | |
56 if (MarkObjectWithoutPush(obj)) { | |
57 marking_deque_.PushBlack(obj); | |
58 return true; | |
59 } | |
60 return false; | |
61 } | |
62 | |
63 | |
64 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { | 55 void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) { |
65 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 56 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
66 if (!mark_bit.Get()) { | 57 if (!mark_bit.Get()) { |
67 mark_bit.Set(); | 58 mark_bit.Set(); |
68 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); | 59 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); |
69 ProcessNewlyMarkedObject(obj); | 60 ProcessNewlyMarkedObject(obj); |
70 } | 61 } |
71 } | 62 } |
72 | 63 |
73 | 64 |
74 bool MarkCompactCollector::MarkObjectWithoutPush(HeapObject* obj) { | 65 bool MarkCompactCollector::MarkObjectWithoutPush(HeapObject* object) { |
75 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 66 MarkBit mark = Marking::MarkBitFrom(object); |
76 if (!mark_bit.Get()) { | 67 bool old_mark = mark.Get(); |
77 SetMark(obj, mark_bit); | 68 if (!old_mark) SetMark(object, mark); |
78 return true; | 69 return old_mark; |
79 } | |
80 return false; | |
81 } | 70 } |
82 | 71 |
83 | 72 |
| 73 void MarkCompactCollector::MarkObjectAndPush(HeapObject* object) { |
| 74 if (!MarkObjectWithoutPush(object)) marking_deque_.PushBlack(object); |
| 75 } |
| 76 |
| 77 |
84 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { | 78 void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) { |
85 ASSERT(!mark_bit.Get()); | 79 ASSERT(!mark_bit.Get()); |
86 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 80 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
87 mark_bit.Set(); | 81 mark_bit.Set(); |
88 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); | 82 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); |
89 if (obj->IsMap()) { | 83 if (obj->IsMap()) { |
90 heap_->ClearCacheOnMap(Map::cast(obj)); | 84 heap_->ClearCacheOnMap(Map::cast(obj)); |
91 } | 85 } |
92 } | 86 } |
93 | 87 |
(...skipping 17 matching lines...) Expand all Loading... |
111 SlotsBuffer::FAIL_ON_OVERFLOW)) { | 105 SlotsBuffer::FAIL_ON_OVERFLOW)) { |
112 EvictEvacuationCandidate(object_page); | 106 EvictEvacuationCandidate(object_page); |
113 } | 107 } |
114 } | 108 } |
115 } | 109 } |
116 | 110 |
117 | 111 |
118 } } // namespace v8::internal | 112 } } // namespace v8::internal |
119 | 113 |
120 #endif // V8_MARK_COMPACT_INL_H_ | 114 #endif // V8_MARK_COMPACT_INL_H_ |
OLD | NEW |