| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj, | 89 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj, |
| 90 MarkBit mark_bit) { | 90 MarkBit mark_bit) { |
| 91 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 91 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
| 92 ASSERT(obj->Size() >= 2*kPointerSize); | 92 ASSERT(obj->Size() >= 2*kPointerSize); |
| 93 ASSERT(IsMarking()); | 93 ASSERT(IsMarking()); |
| 94 Marking::BlackToGrey(mark_bit); | 94 Marking::BlackToGrey(mark_bit); |
| 95 int64_t old_bytes_rescanned = bytes_rescanned_; |
| 96 bytes_rescanned_ = old_bytes_rescanned + obj->Size(); |
| 97 if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) { |
| 98 if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSize()) { |
| 99 // If we have queued twice the heap size for rescanning then we are |
| 100 // going around in circles, scanning the same objects again and again |
| 101 // as the program mutates the heap faster than we can incrementally |
| 102 // trace it. In this case we switch to non-incremental marking in |
| 103 // order to finish off this marking phase. |
| 104 if (FLAG_trace_gc) { |
| 105 PrintF("Hurrying incremental marking because of lack of progress\n"); |
| 106 } |
| 107 allocation_marking_factor_ = kMaxAllocationMarkingFactor; |
| 108 } |
| 109 } |
| 95 | 110 |
| 96 marking_deque_.UnshiftGrey(obj); | 111 marking_deque_.UnshiftGrey(obj); |
| 97 } | 112 } |
| 98 | 113 |
| 99 | 114 |
| 100 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { | 115 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { |
| 101 WhiteToGrey(obj, mark_bit); | 116 WhiteToGrey(obj, mark_bit); |
| 102 marking_deque_.PushGrey(obj); | 117 marking_deque_.PushGrey(obj); |
| 103 } | 118 } |
| 104 | 119 |
| 105 | 120 |
| 106 void IncrementalMarking::WhiteToGrey(HeapObject* obj, MarkBit mark_bit) { | 121 void IncrementalMarking::WhiteToGrey(HeapObject* obj, MarkBit mark_bit) { |
| 107 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 122 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
| 108 ASSERT(obj->Size() >= 2*kPointerSize); | 123 ASSERT(obj->Size() >= 2*kPointerSize); |
| 109 ASSERT(IsMarking()); | 124 ASSERT(IsMarking()); |
| 110 Marking::WhiteToGrey(mark_bit); | 125 Marking::WhiteToGrey(mark_bit); |
| 111 } | 126 } |
| 112 | 127 |
| 113 | 128 |
| 114 } } // namespace v8::internal | 129 } } // namespace v8::internal |
| 115 | 130 |
| 116 #endif // V8_INCREMENTAL_MARKING_INL_H_ | 131 #endif // V8_INCREMENTAL_MARKING_INL_H_ |
| OLD | NEW |