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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 | 90 |
91 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj, | 91 void IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj, |
92 MarkBit mark_bit) { | 92 MarkBit mark_bit) { |
93 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); | 93 ASSERT(Marking::MarkBitFrom(obj) == mark_bit); |
94 ASSERT(obj->Size() >= 2*kPointerSize); | 94 ASSERT(obj->Size() >= 2*kPointerSize); |
95 ASSERT(IsMarking()); | 95 ASSERT(IsMarking()); |
96 Marking::BlackToGrey(mark_bit); | 96 Marking::BlackToGrey(mark_bit); |
97 int obj_size = obj->Size(); | 97 int obj_size = obj->Size(); |
98 MemoryChunk::IncrementLiveBytes(obj->address(), -obj_size); | 98 MemoryChunk::IncrementLiveBytes(obj->address(), -obj_size); |
| 99 bytes_scanned_ -= obj_size; |
99 int64_t old_bytes_rescanned = bytes_rescanned_; | 100 int64_t old_bytes_rescanned = bytes_rescanned_; |
100 bytes_rescanned_ = old_bytes_rescanned + obj_size; | 101 bytes_rescanned_ = old_bytes_rescanned + obj_size; |
101 if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) { | 102 if ((bytes_rescanned_ >> 20) != (old_bytes_rescanned >> 20)) { |
102 if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSize()) { | 103 if (bytes_rescanned_ > 2 * heap_->PromotedSpaceSize()) { |
103 // If we have queued twice the heap size for rescanning then we are | 104 // If we have queued twice the heap size for rescanning then we are |
104 // going around in circles, scanning the same objects again and again | 105 // going around in circles, scanning the same objects again and again |
105 // as the program mutates the heap faster than we can incrementally | 106 // as the program mutates the heap faster than we can incrementally |
106 // trace it. In this case we switch to non-incremental marking in | 107 // trace it. In this case we switch to non-incremental marking in |
107 // order to finish off this marking phase. | 108 // order to finish off this marking phase. |
108 if (FLAG_trace_gc) { | 109 if (FLAG_trace_gc) { |
(...skipping 14 matching lines...) Expand all Loading... |
123 | 124 |
124 | 125 |
125 void IncrementalMarking::WhiteToGrey(HeapObject* obj, MarkBit mark_bit) { | 126 void IncrementalMarking::WhiteToGrey(HeapObject* obj, MarkBit mark_bit) { |
126 Marking::WhiteToGrey(mark_bit); | 127 Marking::WhiteToGrey(mark_bit); |
127 } | 128 } |
128 | 129 |
129 | 130 |
130 } } // namespace v8::internal | 131 } } // namespace v8::internal |
131 | 132 |
132 #endif // V8_INCREMENTAL_MARKING_INL_H_ | 133 #endif // V8_INCREMENTAL_MARKING_INL_H_ |
OLD | NEW |