| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 | 110 |
| 111 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj, | 111 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj, |
| 112 MarkBit mark_bit) { | 112 MarkBit mark_bit) { |
| 113 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 113 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
| 114 ASSERT(obj->Size() >= 2*kPointerSize); | 114 ASSERT(obj->Size() >= 2*kPointerSize); |
| 115 ASSERT(IsMarking()); | 115 ASSERT(IsMarking()); |
| 116 Marking::BlackToGrey(mark_bit); | 116 Marking::BlackToGrey(mark_bit); |
| 117 int obj_size = obj->Size(); |
| 118 MemoryChunk::IncrementLiveBytes(obj->address(), -obj_size); |
| 117 int64_t old_bytes_rescanned = bytes_rescanned_; | 119 int64_t old_bytes_rescanned = bytes_rescanned_; |
| 118 bytes_rescanned_ = old_bytes_rescanned + obj->Size(); | 120 bytes_rescanned_ = old_bytes_rescanned + obj_size; |
| 119 if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) { | 121 if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) { |
| 120 if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSize()) { | 122 if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSize()) { |
| 121 // If we have queued twice the heap size for rescanning then we are | 123 // If we have queued twice the heap size for rescanning then we are |
| 122 // going around in circles, scanning the same objects again and again | 124 // going around in circles, scanning the same objects again and again |
| 123 // as the program mutates the heap faster than we can incrementally | 125 // as the program mutates the heap faster than we can incrementally |
| 124 // trace it. In this case we switch to non-incremental marking in | 126 // trace it. In this case we switch to non-incremental marking in |
| 125 // order to finish off this marking phase. | 127 // order to finish off this marking phase. |
| 126 if (FLAG_trace_gc) { | 128 if (FLAG_trace_gc) { |
| 127 PrintF("Hurrying incremental marking because of lack of progress\n"); | 129 PrintF("Hurrying incremental marking because of lack of progress\n"); |
| 128 } | 130 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 144 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 146 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
| 145 ASSERT(obj->Size() >= 2*kPointerSize); | 147 ASSERT(obj->Size() >= 2*kPointerSize); |
| 146 ASSERT(IsMarking()); | 148 ASSERT(IsMarking()); |
| 147 Marking::WhiteToGrey(mark_bit); | 149 Marking::WhiteToGrey(mark_bit); |
| 148 } | 150 } |
| 149 | 151 |
| 150 | 152 |
| 151 } } // namespace v8::internal | 153 } } // namespace v8::internal |
| 152 | 154 |
| 153 #endif // V8_INCREMENTAL_MARKING_INL_H_ | 155 #endif // V8_INCREMENTAL_MARKING_INL_H_ |
| OLD | NEW |