Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: src/heap/mark-compact-inl.h

Issue 2224823003: [heap] Temporarily use old live object iterator to investigate Win 10 memory regression. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_MARK_COMPACT_INL_H_ 5 #ifndef V8_HEAP_MARK_COMPACT_INL_H_
6 #define V8_HEAP_MARK_COMPACT_INL_H_ 6 #define V8_HEAP_MARK_COMPACT_INL_H_
7 7
8 #include "src/heap/mark-compact.h" 8 #include "src/heap/mark-compact.h"
9 #include "src/heap/remembered-set.h" 9 #include "src/heap/remembered-set.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // Clear the first bit of the found object.. 141 // Clear the first bit of the found object..
142 current_cell_ &= ~(1u << trailing_zeros); 142 current_cell_ &= ~(1u << trailing_zeros);
143 143
144 uint32_t second_bit_index = 0; 144 uint32_t second_bit_index = 0;
145 if (trailing_zeros < Bitmap::kBitIndexMask) { 145 if (trailing_zeros < Bitmap::kBitIndexMask) {
146 second_bit_index = 1u << (trailing_zeros + 1); 146 second_bit_index = 1u << (trailing_zeros + 1);
147 } else { 147 } else {
148 second_bit_index = 0x1; 148 second_bit_index = 0x1;
149 // The overlapping case; there has to exist a cell after the current 149 // The overlapping case; there has to exist a cell after the current
150 // cell. 150 // cell.
151 // However, if there is a black area at the end of the page, and the 151 DCHECK(!it_.Done());
152 // last word is a one word filler, we are not allowed to advance. In
153 // that case we can return immediately.
154 if (it_.Done()) {
155 DCHECK(HeapObject::FromAddress(addr)->map() ==
156 HeapObject::FromAddress(addr)
157 ->GetHeap()
158 ->one_pointer_filler_map());
159 return nullptr;
160 }
161 it_.Advance(); 152 it_.Advance();
162 cell_base_ = it_.CurrentCellBase(); 153 cell_base_ = it_.CurrentCellBase();
163 current_cell_ = *it_.CurrentCell(); 154 current_cell_ = *it_.CurrentCell();
164 } 155 }
165 156 if (T == kBlackObjects && (current_cell_ & second_bit_index)) {
166 if (current_cell_ & second_bit_index) { 157 object = HeapObject::FromAddress(addr);
167 // We found a black object. If the black object is within a black area, 158 } else if (T == kGreyObjects && !(current_cell_ & second_bit_index)) {
168 // make sure that we skip all set bits in the black area until the 159 object = HeapObject::FromAddress(addr);
169 // object ends. 160 } else if (T == kAllLiveObjects) {
170 HeapObject* black_object = HeapObject::FromAddress(addr);
171 Address end = addr + black_object->Size();
172 // One word filler objects do not borrow the second mark bit. We have
173 // to jump over the advancing and clearing part.
174 // Note that we know that we are at a one word filler when
175 // object_start + object_size - kPointerSize == object_start.
176 if (addr != end) {
177 // Clear all bits from second_bit_index.
178 current_cell_ &= ~(second_bit_index | (second_bit_index - 1));
179
180 // Check that all bits corresponding to in object fields after the
181 // two cleared bits in the beginning are indeed zero.
182 CHECK(chunk_->markbits()->AllBitsClearInRange(
183 chunk_->AddressToMarkbitIndex(addr + 2 * kPointerSize),
184 chunk_->AddressToMarkbitIndex(end)));
185 }
186
187 if (T == kBlackObjects || T == kAllLiveObjects) {
188 object = black_object;
189 }
190 } else if ((T == kGreyObjects || T == kAllLiveObjects)) {
191 object = HeapObject::FromAddress(addr); 161 object = HeapObject::FromAddress(addr);
192 } 162 }
193 163
164 // Clear the second bit of the found object.
165 current_cell_ &= ~second_bit_index;
166
194 // We found a live object. 167 // We found a live object.
195 if (object != nullptr) { 168 if (object != nullptr) break;
196 if (object->IsFiller()) {
197 // Black areas together with slack tracking may result in black filler
198 // objects. We filter these objects out in the iterator.
199 object = nullptr;
200 } else {
201 break;
202 }
203 }
204 } 169 }
205
206 if (current_cell_ == 0) { 170 if (current_cell_ == 0) {
207 if (!it_.Done()) { 171 if (!it_.Done()) {
208 it_.Advance(); 172 it_.Advance();
209 cell_base_ = it_.CurrentCellBase(); 173 cell_base_ = it_.CurrentCellBase();
210 current_cell_ = *it_.CurrentCell(); 174 current_cell_ = *it_.CurrentCell();
211 } 175 }
212 } 176 }
213 if (object != nullptr) return object; 177 if (object != nullptr) return object;
214 } 178 }
215 return nullptr; 179 return nullptr;
216 } 180 }
217 181
218 } // namespace internal 182 } // namespace internal
219 } // namespace v8 183 } // namespace v8
220 184
221 #endif // V8_HEAP_MARK_COMPACT_INL_H_ 185 #endif // V8_HEAP_MARK_COMPACT_INL_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698