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 Marking::MarkBlack(Marking::MarkBitFrom(obj)); |
| 4244 MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size()); |
| 4245 addr += obj->Size(); |
| 4246 } |
| 4247 } |
| 4248 } |
4233 for (int i = OLD_SPACE; i < Serializer::kNumberOfSpaces; i++) { | 4249 for (int i = OLD_SPACE; i < Serializer::kNumberOfSpaces; i++) { |
4234 const Heap::Reservation& res = reservations[i]; | 4250 const Heap::Reservation& res = reservations[i]; |
4235 for (auto& chunk : res) { | 4251 for (auto& chunk : res) { |
4236 Address addr = chunk.start; | 4252 Address addr = chunk.start; |
4237 while (addr < chunk.end) { | 4253 while (addr < chunk.end) { |
4238 HeapObject* obj = HeapObject::FromAddress(addr); | 4254 HeapObject* obj = HeapObject::FromAddress(addr); |
4239 incremental_marking()->IterateBlackObject(obj); | 4255 incremental_marking()->IterateBlackObject(obj); |
4240 addr += obj->Size(); | 4256 addr += obj->Size(); |
4241 } | 4257 } |
4242 } | 4258 } |
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6425 } | 6441 } |
6426 | 6442 |
6427 | 6443 |
6428 // static | 6444 // static |
6429 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6445 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6430 return StaticVisitorBase::GetVisitorId(map); | 6446 return StaticVisitorBase::GetVisitorId(map); |
6431 } | 6447 } |
6432 | 6448 |
6433 } // namespace internal | 6449 } // namespace internal |
6434 } // namespace v8 | 6450 } // namespace v8 |
OLD | NEW |