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/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/ast/context-slot-cache.h" | 10 #include "src/ast/context-slot-cache.h" |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 if (reached_limit == IncrementalMarkingLimit::kSoftLimit) { | 1108 if (reached_limit == IncrementalMarkingLimit::kSoftLimit) { |
1109 incremental_marking()->incremental_marking_job()->ScheduleTask(this); | 1109 incremental_marking()->incremental_marking_job()->ScheduleTask(this); |
1110 } else if (reached_limit == IncrementalMarkingLimit::kHardLimit) { | 1110 } else if (reached_limit == IncrementalMarkingLimit::kHardLimit) { |
1111 StartIncrementalMarking(gc_flags, | 1111 StartIncrementalMarking(gc_flags, |
1112 GarbageCollectionReason::kAllocationLimit, | 1112 GarbageCollectionReason::kAllocationLimit, |
1113 gc_callback_flags); | 1113 gc_callback_flags); |
1114 } | 1114 } |
1115 } | 1115 } |
1116 } | 1116 } |
1117 | 1117 |
1118 void Heap::StartIdleIncrementalMarking(GarbageCollectionReason gc_reason) { | 1118 void Heap::StartIdleIncrementalMarking( |
| 1119 GarbageCollectionReason gc_reason, |
| 1120 const GCCallbackFlags gc_callback_flags) { |
1119 gc_idle_time_handler_->ResetNoProgressCounter(); | 1121 gc_idle_time_handler_->ResetNoProgressCounter(); |
1120 StartIncrementalMarking(kReduceMemoryFootprintMask, gc_reason, | 1122 StartIncrementalMarking(kReduceMemoryFootprintMask, gc_reason, |
1121 kNoGCCallbackFlags); | 1123 gc_callback_flags); |
1122 } | 1124 } |
1123 | 1125 |
1124 | 1126 |
1125 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index, | 1127 void Heap::MoveElements(FixedArray* array, int dst_index, int src_index, |
1126 int len) { | 1128 int len) { |
1127 if (len == 0) return; | 1129 if (len == 0) return; |
1128 | 1130 |
1129 DCHECK(array->map() != fixed_cow_array_map()); | 1131 DCHECK(array->map() != fixed_cow_array_map()); |
1130 Object** dst_objects = array->data_start() + dst_index; | 1132 Object** dst_objects = array->data_start() + dst_index; |
1131 MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize); | 1133 MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize); |
(...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4225 if (incremental_marking()->IsMarking() && | 4227 if (incremental_marking()->IsMarking() && |
4226 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || | 4228 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
4227 (!incremental_marking()->finalize_marking_completed() && | 4229 (!incremental_marking()->finalize_marking_completed() && |
4228 mark_compact_collector()->marking_deque()->IsEmpty() && | 4230 mark_compact_collector()->marking_deque()->IsEmpty() && |
4229 local_embedder_heap_tracer()->ShouldFinalizeIncrementalMarking()))) { | 4231 local_embedder_heap_tracer()->ShouldFinalizeIncrementalMarking()))) { |
4230 FinalizeIncrementalMarking(gc_reason); | 4232 FinalizeIncrementalMarking(gc_reason); |
4231 } else if (incremental_marking()->IsComplete() || | 4233 } else if (incremental_marking()->IsComplete() || |
4232 (mark_compact_collector()->marking_deque()->IsEmpty() && | 4234 (mark_compact_collector()->marking_deque()->IsEmpty() && |
4233 local_embedder_heap_tracer() | 4235 local_embedder_heap_tracer() |
4234 ->ShouldFinalizeIncrementalMarking())) { | 4236 ->ShouldFinalizeIncrementalMarking())) { |
4235 CollectAllGarbage(current_gc_flags_, gc_reason); | 4237 CollectAllGarbage(current_gc_flags_, gc_reason, current_gc_callback_flags_); |
4236 } | 4238 } |
4237 } | 4239 } |
4238 | 4240 |
4239 void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) { | 4241 void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) { |
4240 // TODO(hpayer): We do not have to iterate reservations on black objects | 4242 // TODO(hpayer): We do not have to iterate reservations on black objects |
4241 // for marking. We just have to execute the special visiting side effect | 4243 // for marking. We just have to execute the special visiting side effect |
4242 // code that adds objects to global data structures, e.g. for array buffers. | 4244 // code that adds objects to global data structures, e.g. for array buffers. |
4243 | 4245 |
4244 if (incremental_marking()->black_allocation()) { | 4246 if (incremental_marking()->black_allocation()) { |
4245 // Iterate black objects in old space, code space, map space, and large | 4247 // Iterate black objects in old space, code space, map space, and large |
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6389 case LO_SPACE: | 6391 case LO_SPACE: |
6390 return "LO_SPACE"; | 6392 return "LO_SPACE"; |
6391 default: | 6393 default: |
6392 UNREACHABLE(); | 6394 UNREACHABLE(); |
6393 } | 6395 } |
6394 return NULL; | 6396 return NULL; |
6395 } | 6397 } |
6396 | 6398 |
6397 } // namespace internal | 6399 } // namespace internal |
6398 } // namespace v8 | 6400 } // namespace v8 |
OLD | NEW |