| 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 18 matching lines...) Expand all Loading... |
| 29 #include "src/heap/objects-visiting.h" | 29 #include "src/heap/objects-visiting.h" |
| 30 #include "src/heap/remembered-set.h" | 30 #include "src/heap/remembered-set.h" |
| 31 #include "src/heap/scavenge-job.h" | 31 #include "src/heap/scavenge-job.h" |
| 32 #include "src/heap/scavenger-inl.h" | 32 #include "src/heap/scavenger-inl.h" |
| 33 #include "src/heap/store-buffer.h" | 33 #include "src/heap/store-buffer.h" |
| 34 #include "src/interpreter/interpreter.h" | 34 #include "src/interpreter/interpreter.h" |
| 35 #include "src/profiler/cpu-profiler.h" | 35 #include "src/profiler/cpu-profiler.h" |
| 36 #include "src/regexp/jsregexp.h" | 36 #include "src/regexp/jsregexp.h" |
| 37 #include "src/runtime-profiler.h" | 37 #include "src/runtime-profiler.h" |
| 38 #include "src/snapshot/natives.h" | 38 #include "src/snapshot/natives.h" |
| 39 #include "src/snapshot/serialize.h" | 39 #include "src/snapshot/serializer-common.h" |
| 40 #include "src/snapshot/snapshot.h" | 40 #include "src/snapshot/snapshot.h" |
| 41 #include "src/tracing/trace-event.h" | 41 #include "src/tracing/trace-event.h" |
| 42 #include "src/type-feedback-vector.h" | 42 #include "src/type-feedback-vector.h" |
| 43 #include "src/utils.h" | 43 #include "src/utils.h" |
| 44 #include "src/v8.h" | 44 #include "src/v8.h" |
| 45 #include "src/v8threads.h" | 45 #include "src/v8threads.h" |
| 46 #include "src/vm-state-inl.h" | 46 #include "src/vm-state-inl.h" |
| 47 | 47 |
| 48 namespace v8 { | 48 namespace v8 { |
| 49 namespace internal { | 49 namespace internal { |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 } | 1136 } |
| 1137 #endif // VERIFY_HEAP | 1137 #endif // VERIFY_HEAP |
| 1138 | 1138 |
| 1139 | 1139 |
| 1140 bool Heap::ReserveSpace(Reservation* reservations) { | 1140 bool Heap::ReserveSpace(Reservation* reservations) { |
| 1141 bool gc_performed = true; | 1141 bool gc_performed = true; |
| 1142 int counter = 0; | 1142 int counter = 0; |
| 1143 static const int kThreshold = 20; | 1143 static const int kThreshold = 20; |
| 1144 while (gc_performed && counter++ < kThreshold) { | 1144 while (gc_performed && counter++ < kThreshold) { |
| 1145 gc_performed = false; | 1145 gc_performed = false; |
| 1146 for (int space = NEW_SPACE; space < Serializer::kNumberOfSpaces; space++) { | 1146 for (int space = NEW_SPACE; space < SerializerDeserializer::kNumberOfSpaces; |
| 1147 space++) { |
| 1147 Reservation* reservation = &reservations[space]; | 1148 Reservation* reservation = &reservations[space]; |
| 1148 DCHECK_LE(1, reservation->length()); | 1149 DCHECK_LE(1, reservation->length()); |
| 1149 if (reservation->at(0).size == 0) continue; | 1150 if (reservation->at(0).size == 0) continue; |
| 1150 bool perform_gc = false; | 1151 bool perform_gc = false; |
| 1151 if (space == LO_SPACE) { | 1152 if (space == LO_SPACE) { |
| 1152 DCHECK_EQ(1, reservation->length()); | 1153 DCHECK_EQ(1, reservation->length()); |
| 1153 perform_gc = !CanExpandOldGeneration(reservation->at(0).size); | 1154 perform_gc = !CanExpandOldGeneration(reservation->at(0).size); |
| 1154 } else { | 1155 } else { |
| 1155 for (auto& chunk : *reservation) { | 1156 for (auto& chunk : *reservation) { |
| 1156 AllocationResult allocation; | 1157 AllocationResult allocation; |
| 1157 int size = chunk.size; | 1158 int size = chunk.size; |
| 1158 DCHECK_LE(size, MemoryAllocator::PageAreaSize( | 1159 DCHECK_LE(size, MemoryAllocator::PageAreaSize( |
| 1159 static_cast<AllocationSpace>(space))); | 1160 static_cast<AllocationSpace>(space))); |
| 1160 if (space == NEW_SPACE) { | 1161 if (space == NEW_SPACE) { |
| 1161 allocation = new_space()->AllocateRawUnaligned(size); | 1162 allocation = new_space()->AllocateRawUnaligned(size); |
| 1162 } else { | 1163 } else { |
| 1163 allocation = paged_space(space)->AllocateRawUnaligned(size); | 1164 allocation = paged_space(space)->AllocateRawUnaligned(size); |
| 1164 } | 1165 } |
| 1165 HeapObject* free_space = nullptr; | 1166 HeapObject* free_space = nullptr; |
| 1166 if (allocation.To(&free_space)) { | 1167 if (allocation.To(&free_space)) { |
| 1167 // Mark with a free list node, in case we have a GC before | 1168 // Mark with a free list node, in case we have a GC before |
| 1168 // deserializing. | 1169 // deserializing. |
| 1169 Address free_space_address = free_space->address(); | 1170 Address free_space_address = free_space->address(); |
| 1170 CreateFillerObjectAt(free_space_address, size, | 1171 CreateFillerObjectAt(free_space_address, size, |
| 1171 ClearRecordedSlots::kNo); | 1172 ClearRecordedSlots::kNo); |
| 1172 DCHECK(space < Serializer::kNumberOfPreallocatedSpaces); | 1173 DCHECK(space < SerializerDeserializer::kNumberOfPreallocatedSpaces); |
| 1173 chunk.start = free_space_address; | 1174 chunk.start = free_space_address; |
| 1174 chunk.end = free_space_address + size; | 1175 chunk.end = free_space_address + size; |
| 1175 } else { | 1176 } else { |
| 1176 perform_gc = true; | 1177 perform_gc = true; |
| 1177 break; | 1178 break; |
| 1178 } | 1179 } |
| 1179 } | 1180 } |
| 1180 } | 1181 } |
| 1181 if (perform_gc) { | 1182 if (perform_gc) { |
| 1182 if (space == NEW_SPACE) { | 1183 if (space == NEW_SPACE) { |
| (...skipping 5159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6342 } | 6343 } |
| 6343 | 6344 |
| 6344 | 6345 |
| 6345 // static | 6346 // static |
| 6346 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6347 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6347 return StaticVisitorBase::GetVisitorId(map); | 6348 return StaticVisitorBase::GetVisitorId(map); |
| 6348 } | 6349 } |
| 6349 | 6350 |
| 6350 } // namespace internal | 6351 } // namespace internal |
| 6351 } // namespace v8 | 6352 } // namespace v8 |
| OLD | NEW |