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

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

Issue 2857003002: [heap] Fix live object iterator bail out case. (Closed)
Patch Set: change checks Created 3 years, 7 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 uint32_t second_bit_index = 0; 167 uint32_t second_bit_index = 0;
168 if (trailing_zeros < Bitmap::kBitIndexMask) { 168 if (trailing_zeros < Bitmap::kBitIndexMask) {
169 second_bit_index = 1u << (trailing_zeros + 1); 169 second_bit_index = 1u << (trailing_zeros + 1);
170 } else { 170 } else {
171 second_bit_index = 0x1; 171 second_bit_index = 0x1;
172 // The overlapping case; there has to exist a cell after the current 172 // The overlapping case; there has to exist a cell after the current
173 // cell. 173 // cell.
174 // However, if there is a black area at the end of the page, and the 174 // However, if there is a black area at the end of the page, and the
175 // last word is a one word filler, we are not allowed to advance. In 175 // last word is a one word filler, we are not allowed to advance. In
176 // that case we can return immediately. 176 // that case we can return immediately.
177 if (it_.Done()) { 177 if (!it_.Advance()) {
178 DCHECK(HeapObject::FromAddress(addr)->map() == 178 DCHECK(HeapObject::FromAddress(addr)->map() ==
179 HeapObject::FromAddress(addr) 179 HeapObject::FromAddress(addr)
180 ->GetHeap() 180 ->GetHeap()
181 ->one_pointer_filler_map()); 181 ->one_pointer_filler_map());
182 return nullptr; 182 return nullptr;
183 } 183 }
184 bool not_done = it_.Advance();
185 USE(not_done);
186 DCHECK(not_done);
187 cell_base_ = it_.CurrentCellBase(); 184 cell_base_ = it_.CurrentCellBase();
188 current_cell_ = *it_.CurrentCell(); 185 current_cell_ = *it_.CurrentCell();
189 } 186 }
190 187
191 Map* map = nullptr; 188 Map* map = nullptr;
192 if (current_cell_ & second_bit_index) { 189 if (current_cell_ & second_bit_index) {
193 // We found a black object. If the black object is within a black area, 190 // We found a black object. If the black object is within a black area,
194 // make sure that we skip all set bits in the black area until the 191 // make sure that we skip all set bits in the black area until the
195 // object ends. 192 // object ends.
196 HeapObject* black_object = HeapObject::FromAddress(addr); 193 HeapObject* black_object = HeapObject::FromAddress(addr);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // do not clear the old location of the object start. 235 // do not clear the old location of the object start.
239 // We filter these objects out in the iterator. 236 // We filter these objects out in the iterator.
240 object = nullptr; 237 object = nullptr;
241 } else { 238 } else {
242 break; 239 break;
243 } 240 }
244 } 241 }
245 } 242 }
246 243
247 if (current_cell_ == 0) { 244 if (current_cell_ == 0) {
248 if (!it_.Done() && it_.Advance()) { 245 if (it_.Advance()) {
249 cell_base_ = it_.CurrentCellBase(); 246 cell_base_ = it_.CurrentCellBase();
250 current_cell_ = *it_.CurrentCell(); 247 current_cell_ = *it_.CurrentCell();
251 } 248 }
252 } 249 }
253 if (object != nullptr) return object; 250 if (object != nullptr) return object;
254 } 251 }
255 return nullptr; 252 return nullptr;
256 } 253 }
257 254
258 } // namespace internal 255 } // namespace internal
259 } // namespace v8 256 } // namespace v8
260 257
261 #endif // V8_HEAP_MARK_COMPACT_INL_H_ 258 #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