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

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

Issue 2160613002: [heap] Remove black pages and use black areas instead. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: perform cast after writing map Created 4 years, 5 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 | « src/heap/mark-compact.cc ('k') | src/heap/marking.h » ('j') | 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 DCHECK(!it_.Done()); 151 DCHECK(!it_.Done());
152 it_.Advance(); 152 it_.Advance();
153 cell_base_ = it_.CurrentCellBase(); 153 cell_base_ = it_.CurrentCellBase();
154 current_cell_ = *it_.CurrentCell(); 154 current_cell_ = *it_.CurrentCell();
155 } 155 }
156 if (T == kBlackObjects && (current_cell_ & second_bit_index)) { 156
157 object = HeapObject::FromAddress(addr); 157 if (current_cell_ & second_bit_index) {
158 } else if (T == kGreyObjects && !(current_cell_ & second_bit_index)) { 158 // We found a black object. If the black object is within a black area,
159 object = HeapObject::FromAddress(addr); 159 // make sure that we skip all set bits in the black area until the
160 } else if (T == kAllLiveObjects) { 160 // object ends.
161 HeapObject* black_object = HeapObject::FromAddress(addr);
162 Address end = addr + black_object->Size() - kPointerSize;
163 DCHECK_EQ(chunk_, MemoryChunk::FromAddress(end));
164 uint32_t end_mark_bit_index = chunk_->AddressToMarkbitIndex(end);
165 unsigned int end_cell_index =
166 end_mark_bit_index >> Bitmap::kBitsPerCellLog2;
167 MarkBit::CellType end_index_mask =
168 1u << Bitmap::IndexInCell(end_mark_bit_index);
169 if (it_.Advance(end_cell_index)) {
170 cell_base_ = it_.CurrentCellBase();
171 current_cell_ = *it_.CurrentCell();
172 }
173
174 // Clear all bits in current_cell, including the end index.
175 current_cell_ &= ~(end_index_mask + end_index_mask - 1);
176
177 if (T == kBlackObjects || T == kAllLiveObjects) {
178 object = black_object;
179 }
180 } else if ((T == kGreyObjects || T == kAllLiveObjects)) {
161 object = HeapObject::FromAddress(addr); 181 object = HeapObject::FromAddress(addr);
162 } 182 }
163 183
164 // Clear the second bit of the found object.
165 current_cell_ &= ~second_bit_index;
166
167 // We found a live object. 184 // We found a live object.
168 if (object != nullptr) break; 185 if (object != nullptr) break;
169 } 186 }
187
170 if (current_cell_ == 0) { 188 if (current_cell_ == 0) {
171 if (!it_.Done()) { 189 if (!it_.Done()) {
172 it_.Advance(); 190 it_.Advance();
173 cell_base_ = it_.CurrentCellBase(); 191 cell_base_ = it_.CurrentCellBase();
174 current_cell_ = *it_.CurrentCell(); 192 current_cell_ = *it_.CurrentCell();
175 } 193 }
176 } 194 }
177 if (object != nullptr) return object; 195 if (object != nullptr) return object;
178 } 196 }
179 return nullptr; 197 return nullptr;
180 } 198 }
181 199
182 } // namespace internal 200 } // namespace internal
183 } // namespace v8 201 } // namespace v8
184 202
185 #endif // V8_HEAP_MARK_COMPACT_INL_H_ 203 #endif // V8_HEAP_MARK_COMPACT_INL_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698