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 #include "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 4211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4222 "idle notification: finalize incremental marking"); | 4222 "idle notification: finalize incremental marking"); |
| 4223 return true; | 4223 return true; |
| 4224 } | 4224 } |
| 4225 return false; | 4225 return false; |
| 4226 } | 4226 } |
| 4227 | 4227 |
| 4228 void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) { | 4228 void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) { |
| 4229 // TODO(hpayer): We do not have to iterate reservations on black objects | 4229 // TODO(hpayer): We do not have to iterate reservations on black objects |
| 4230 // for marking. We just have to execute the special visiting side effect | 4230 // for marking. We just have to execute the special visiting side effect |
| 4231 // code that adds objects to global data structures, e.g. for array buffers. | 4231 // code that adds objects to global data structures, e.g. for array buffers. |
| 4232 | |
| 4233 // Code space, map space, and large object space do not use black pages. | |
| 4234 // Hence we have to color all objects of the reservation first black to avoid | |
| 4235 // unnecessary marking deque load. | |
| 4232 if (incremental_marking()->black_allocation()) { | 4236 if (incremental_marking()->black_allocation()) { |
| 4237 for (int i = CODE_SPACE; i < Serializer::kNumberOfSpaces; i++) { | |
| 4238 const Heap::Reservation& res = reservations[i]; | |
| 4239 for (auto& chunk : res) { | |
| 4240 Address addr = chunk.start; | |
| 4241 while (addr < chunk.end) { | |
| 4242 HeapObject* obj = HeapObject::FromAddress(addr); | |
| 4243 if (i != OLD_SPACE) { | |
|
ulan
2016/04/06 16:44:43
DCHECK_NE(i, OLD_SPACE) because loop starts from C
Hannes Payer (out of office)
2016/04/06 21:23:51
Done.
| |
| 4244 Marking::MarkBlack(Marking::MarkBitFrom(obj)); | |
| 4245 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); | |
| 4246 } | |
| 4247 addr += obj->Size(); | |
| 4248 } | |
| 4249 } | |
| 4250 } | |
| 4233 for (int i = OLD_SPACE; i < Serializer::kNumberOfSpaces; i++) { | 4251 for (int i = OLD_SPACE; i < Serializer::kNumberOfSpaces; i++) { |
| 4234 const Heap::Reservation& res = reservations[i]; | 4252 const Heap::Reservation& res = reservations[i]; |
| 4235 for (auto& chunk : res) { | 4253 for (auto& chunk : res) { |
| 4236 Address addr = chunk.start; | 4254 Address addr = chunk.start; |
| 4237 while (addr < chunk.end) { | 4255 while (addr < chunk.end) { |
| 4238 HeapObject* obj = HeapObject::FromAddress(addr); | 4256 HeapObject* obj = HeapObject::FromAddress(addr); |
| 4239 incremental_marking()->IterateBlackObject(obj); | 4257 incremental_marking()->IterateBlackObject(obj); |
| 4240 addr += obj->Size(); | 4258 addr += obj->Size(); |
| 4241 } | 4259 } |
| 4242 } | 4260 } |
| (...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6425 } | 6443 } |
| 6426 | 6444 |
| 6427 | 6445 |
| 6428 // static | 6446 // static |
| 6429 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6447 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6430 return StaticVisitorBase::GetVisitorId(map); | 6448 return StaticVisitorBase::GetVisitorId(map); |
| 6431 } | 6449 } |
| 6432 | 6450 |
| 6433 } // namespace internal | 6451 } // namespace internal |
| 6434 } // namespace v8 | 6452 } // namespace v8 |
| OLD | NEW |