| 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 4237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4248 "idle notification: finalize incremental marking"); | 4248 "idle notification: finalize incremental marking"); |
| 4249 return true; | 4249 return true; |
| 4250 } | 4250 } |
| 4251 return false; | 4251 return false; |
| 4252 } | 4252 } |
| 4253 | 4253 |
| 4254 void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) { | 4254 void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) { |
| 4255 // TODO(hpayer): We do not have to iterate reservations on black objects | 4255 // TODO(hpayer): We do not have to iterate reservations on black objects |
| 4256 // for marking. We just have to execute the special visiting side effect | 4256 // for marking. We just have to execute the special visiting side effect |
| 4257 // code that adds objects to global data structures, e.g. for array buffers. | 4257 // code that adds objects to global data structures, e.g. for array buffers. |
| 4258 |
| 4259 // Code space, map space, and large object space do not use black pages. |
| 4260 // Hence we have to color all objects of the reservation first black to avoid |
| 4261 // unnecessary marking deque load. |
| 4258 if (incremental_marking()->black_allocation()) { | 4262 if (incremental_marking()->black_allocation()) { |
| 4263 for (int i = CODE_SPACE; i < Serializer::kNumberOfSpaces; i++) { |
| 4264 const Heap::Reservation& res = reservations[i]; |
| 4265 for (auto& chunk : res) { |
| 4266 Address addr = chunk.start; |
| 4267 while (addr < chunk.end) { |
| 4268 HeapObject* obj = HeapObject::FromAddress(addr); |
| 4269 Marking::MarkBlack(Marking::MarkBitFrom(obj)); |
| 4270 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); |
| 4271 addr += obj->Size(); |
| 4272 } |
| 4273 } |
| 4274 } |
| 4259 for (int i = OLD_SPACE; i < Serializer::kNumberOfSpaces; i++) { | 4275 for (int i = OLD_SPACE; i < Serializer::kNumberOfSpaces; i++) { |
| 4260 const Heap::Reservation& res = reservations[i]; | 4276 const Heap::Reservation& res = reservations[i]; |
| 4261 for (auto& chunk : res) { | 4277 for (auto& chunk : res) { |
| 4262 Address addr = chunk.start; | 4278 Address addr = chunk.start; |
| 4263 while (addr < chunk.end) { | 4279 while (addr < chunk.end) { |
| 4264 HeapObject* obj = HeapObject::FromAddress(addr); | 4280 HeapObject* obj = HeapObject::FromAddress(addr); |
| 4265 incremental_marking()->IterateBlackObject(obj); | 4281 incremental_marking()->IterateBlackObject(obj); |
| 4266 addr += obj->Size(); | 4282 addr += obj->Size(); |
| 4267 } | 4283 } |
| 4268 } | 4284 } |
| (...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6451 } | 6467 } |
| 6452 | 6468 |
| 6453 | 6469 |
| 6454 // static | 6470 // static |
| 6455 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6471 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6456 return StaticVisitorBase::GetVisitorId(map); | 6472 return StaticVisitorBase::GetVisitorId(map); |
| 6457 } | 6473 } |
| 6458 | 6474 |
| 6459 } // namespace internal | 6475 } // namespace internal |
| 6460 } // namespace v8 | 6476 } // namespace v8 |
| OLD | NEW |