Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 } | 115 } |
| 116 | 116 |
| 117 | 117 |
| 118 void CodeFlusher::ClearNextCandidate(SharedFunctionInfo* candidate) { | 118 void CodeFlusher::ClearNextCandidate(SharedFunctionInfo* candidate) { |
| 119 candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER); | 119 candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER); |
| 120 } | 120 } |
| 121 | 121 |
| 122 | 122 |
| 123 template <LiveObjectIterationMode T> | 123 template <LiveObjectIterationMode T> |
| 124 HeapObject* LiveObjectIterator<T>::Next() { | 124 HeapObject* LiveObjectIterator<T>::Next() { |
| 125 Map* one_word_filler = heap()->one_pointer_filler_map(); | |
| 126 Map* two_word_filler = heap()->two_pointer_filler_map(); | |
| 127 Map* free_space_map = heap()->free_space_map(); | |
| 125 while (!it_.Done()) { | 128 while (!it_.Done()) { |
| 126 HeapObject* object = nullptr; | 129 HeapObject* object = nullptr; |
| 127 while (current_cell_ != 0) { | 130 while (current_cell_ != 0) { |
| 128 uint32_t trailing_zeros = base::bits::CountTrailingZeros32(current_cell_); | 131 uint32_t trailing_zeros = base::bits::CountTrailingZeros32(current_cell_); |
| 129 Address addr = cell_base_ + trailing_zeros * kPointerSize; | 132 Address addr = cell_base_ + trailing_zeros * kPointerSize; |
| 130 | 133 |
| 131 // Clear the first bit of the found object.. | 134 // Clear the first bit of the found object.. |
| 132 current_cell_ &= ~(1u << trailing_zeros); | 135 current_cell_ &= ~(1u << trailing_zeros); |
| 133 | 136 |
| 134 uint32_t second_bit_index = 0; | 137 uint32_t second_bit_index = 0; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 if (T == kBlackObjects || T == kAllLiveObjects) { | 189 if (T == kBlackObjects || T == kAllLiveObjects) { |
| 187 object = black_object; | 190 object = black_object; |
| 188 } | 191 } |
| 189 } else if ((T == kGreyObjects || T == kAllLiveObjects)) { | 192 } else if ((T == kGreyObjects || T == kAllLiveObjects)) { |
| 190 map = base::NoBarrierAtomicValue<Map*>::FromAddress(addr)->Value(); | 193 map = base::NoBarrierAtomicValue<Map*>::FromAddress(addr)->Value(); |
| 191 object = HeapObject::FromAddress(addr); | 194 object = HeapObject::FromAddress(addr); |
| 192 } | 195 } |
| 193 | 196 |
| 194 // We found a live object. | 197 // We found a live object. |
| 195 if (object != nullptr) { | 198 if (object != nullptr) { |
| 196 if (object->IsFiller()) { | 199 if (map == one_word_filler || map == two_word_filler || |
|
ulan
2017/03/24 13:14:18
Can you add a comment why IsFiller doesn't work he
| |
| 200 map == free_space_map) { | |
| 197 // There are two reasons why we can get black or grey fillers: | 201 // There are two reasons why we can get black or grey fillers: |
| 198 // 1) Black areas together with slack tracking may result in black one | 202 // 1) Black areas together with slack tracking may result in black one |
| 199 // word filler objects. | 203 // word filler objects. |
| 200 // 2) Left trimming may leave black or grey fillers behind because we | 204 // 2) Left trimming may leave black or grey fillers behind because we |
| 201 // do not clear the old location of the object start. | 205 // do not clear the old location of the object start. |
| 202 // We filter these objects out in the iterator. | 206 // We filter these objects out in the iterator. |
| 203 object = nullptr; | 207 object = nullptr; |
| 204 } else { | 208 } else { |
| 205 break; | 209 break; |
| 206 } | 210 } |
| 207 } | 211 } |
| 208 } | 212 } |
| 209 | 213 |
| 210 if (current_cell_ == 0) { | 214 if (current_cell_ == 0) { |
| 211 if (!it_.Done() && it_.Advance()) { | 215 if (!it_.Done() && it_.Advance()) { |
| 212 cell_base_ = it_.CurrentCellBase(); | 216 cell_base_ = it_.CurrentCellBase(); |
| 213 current_cell_ = *it_.CurrentCell(); | 217 current_cell_ = *it_.CurrentCell(); |
| 214 } | 218 } |
| 215 } | 219 } |
| 216 if (object != nullptr) return object; | 220 if (object != nullptr) return object; |
| 217 } | 221 } |
| 218 return nullptr; | 222 return nullptr; |
| 219 } | 223 } |
| 220 | 224 |
| 221 } // namespace internal | 225 } // namespace internal |
| 222 } // namespace v8 | 226 } // namespace v8 |
| 223 | 227 |
| 224 #endif // V8_HEAP_MARK_COMPACT_INL_H_ | 228 #endif // V8_HEAP_MARK_COMPACT_INL_H_ |
| OLD | NEW |