| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) { | 104 if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) { |
| 105 if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSizeOfObjects()) { | 105 if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSizeOfObjects()) { |
| 106 // If we have queued twice the heap size for rescanning then we are | 106 // If we have queued twice the heap size for rescanning then we are |
| 107 // going around in circles, scanning the same objects again and again | 107 // going around in circles, scanning the same objects again and again |
| 108 // as the program mutates the heap faster than we can incrementally | 108 // as the program mutates the heap faster than we can incrementally |
| 109 // trace it. In this case we switch to non-incremental marking in | 109 // trace it. In this case we switch to non-incremental marking in |
| 110 // order to finish off this marking phase. | 110 // order to finish off this marking phase. |
| 111 if (FLAG_trace_gc) { | 111 if (FLAG_trace_gc) { |
| 112 PrintPID("Hurrying incremental marking because of lack of progress\n"); | 112 PrintPID("Hurrying incremental marking because of lack of progress\n"); |
| 113 } | 113 } |
| 114 marking_speed_ = kMaxMarkingSpeed; | 114 allocation_marking_factor_ = kMaxAllocationMarkingFactor; |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 marking_deque_.UnshiftGrey(obj); | 118 marking_deque_.UnshiftGrey(obj); |
| 119 } | 119 } |
| 120 | 120 |
| 121 | 121 |
| 122 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { | 122 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { |
| 123 Marking::WhiteToGrey(mark_bit); | 123 Marking::WhiteToGrey(mark_bit); |
| 124 marking_deque_.PushGrey(obj); | 124 marking_deque_.PushGrey(obj); |
| 125 } | 125 } |
| 126 | 126 |
| 127 | 127 |
| 128 bool IncrementalMarking::MarkObjectAndPush(HeapObject* obj) { |
| 129 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
| 130 if (!mark_bit.Get()) { |
| 131 WhiteToGreyAndPush(obj, mark_bit); |
| 132 return true; |
| 133 } |
| 134 return false; |
| 135 } |
| 136 |
| 137 |
| 138 bool IncrementalMarking::MarkObjectWithoutPush(HeapObject* obj) { |
| 139 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
| 140 if (!mark_bit.Get()) { |
| 141 mark_bit.Set(); |
| 142 MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size()); |
| 143 return true; |
| 144 } |
| 145 return false; |
| 146 } |
| 147 |
| 148 |
| 128 } } // namespace v8::internal | 149 } } // namespace v8::internal |
| 129 | 150 |
| 130 #endif // V8_INCREMENTAL_MARKING_INL_H_ | 151 #endif // V8_INCREMENTAL_MARKING_INL_H_ |
| OLD | NEW |