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

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: disable black allocation 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
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 MemoryChunk* chunk = MemoryChunk::FromAddress(end);
ulan 2016/07/19 13:23:32 DCHECK_EQ(chunk_, MemoryChunk::FromAddress(end));
Hannes Payer (out of office) 2016/07/19 14:42:53 Done.
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 }
ulan 2016/07/19 13:23:32 Let's add a comment, something like: Clear all bit
Hannes Payer (out of office) 2016/07/19 14:42:53 Done.
173 current_cell_ &= ~(end_index_mask + end_index_mask - 1);
174
175 if (T == kBlackObjects || T == kAllLiveObjects) {
176 object = black_object;
177 }
178 } else if ((T == kGreyObjects || T == kAllLiveObjects)) {
161 object = HeapObject::FromAddress(addr); 179 object = HeapObject::FromAddress(addr);
162 } 180 }
163 181
164 // Clear the second bit of the found object.
165 current_cell_ &= ~second_bit_index;
166
167 // We found a live object. 182 // We found a live object.
168 if (object != nullptr) break; 183 if (object != nullptr) break;
169 } 184 }
185
170 if (current_cell_ == 0) { 186 if (current_cell_ == 0) {
171 if (!it_.Done()) { 187 if (!it_.Done()) {
172 it_.Advance(); 188 it_.Advance();
173 cell_base_ = it_.CurrentCellBase(); 189 cell_base_ = it_.CurrentCellBase();
174 current_cell_ = *it_.CurrentCell(); 190 current_cell_ = *it_.CurrentCell();
175 } 191 }
176 } 192 }
177 if (object != nullptr) return object; 193 if (object != nullptr) return object;
178 } 194 }
179 return nullptr; 195 return nullptr;
180 } 196 }
181 197
182 } // namespace internal 198 } // namespace internal
183 } // namespace v8 199 } // namespace v8
184 200
185 #endif // V8_HEAP_MARK_COMPACT_INL_H_ 201 #endif // V8_HEAP_MARK_COMPACT_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698