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/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 4168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4179 bool Heap::MarkingDequesAreEmpty() { | 4179 bool Heap::MarkingDequesAreEmpty() { |
4180 return mark_compact_collector()->marking_deque()->IsEmpty() && | 4180 return mark_compact_collector()->marking_deque()->IsEmpty() && |
4181 local_embedder_heap_tracer()->NumberOfWrappersToTrace() == 0; | 4181 local_embedder_heap_tracer()->NumberOfWrappersToTrace() == 0; |
4182 } | 4182 } |
4183 | 4183 |
4184 void Heap::FinalizeIncrementalMarkingIfComplete( | 4184 void Heap::FinalizeIncrementalMarkingIfComplete( |
4185 GarbageCollectionReason gc_reason) { | 4185 GarbageCollectionReason gc_reason) { |
4186 if (incremental_marking()->IsMarking() && | 4186 if (incremental_marking()->IsMarking() && |
4187 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || | 4187 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
4188 (!incremental_marking()->finalize_marking_completed() && | 4188 (!incremental_marking()->finalize_marking_completed() && |
4189 MarkingDequesAreEmpty()))) { | 4189 mark_compact_collector()->marking_deque()->IsEmpty() && |
| 4190 local_embedder_heap_tracer()->ShouldFinalizeIncrementalMarking()))) { |
4190 FinalizeIncrementalMarking(gc_reason); | 4191 FinalizeIncrementalMarking(gc_reason); |
4191 } else if (incremental_marking()->IsComplete() || MarkingDequesAreEmpty()) { | 4192 } else if (incremental_marking()->IsComplete() || |
| 4193 (mark_compact_collector()->marking_deque()->IsEmpty() && |
| 4194 local_embedder_heap_tracer() |
| 4195 ->ShouldFinalizeIncrementalMarking())) { |
4192 CollectAllGarbage(current_gc_flags_, gc_reason); | 4196 CollectAllGarbage(current_gc_flags_, gc_reason); |
4193 } | 4197 } |
4194 } | 4198 } |
4195 | 4199 |
4196 bool Heap::TryFinalizeIdleIncrementalMarking( | 4200 bool Heap::TryFinalizeIdleIncrementalMarking( |
4197 double idle_time_in_ms, GarbageCollectionReason gc_reason) { | 4201 double idle_time_in_ms, GarbageCollectionReason gc_reason) { |
4198 size_t size_of_objects = static_cast<size_t>(SizeOfObjects()); | 4202 size_t size_of_objects = static_cast<size_t>(SizeOfObjects()); |
4199 double final_incremental_mark_compact_speed_in_bytes_per_ms = | 4203 double final_incremental_mark_compact_speed_in_bytes_per_ms = |
4200 tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond(); | 4204 tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond(); |
4201 if (incremental_marking()->IsReadyToOverApproximateWeakClosure() || | 4205 if (incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
4202 (!incremental_marking()->finalize_marking_completed() && | 4206 (!incremental_marking()->finalize_marking_completed() && |
4203 MarkingDequesAreEmpty() && | 4207 mark_compact_collector()->marking_deque()->IsEmpty() && |
| 4208 local_embedder_heap_tracer()->ShouldFinalizeIncrementalMarking() && |
4204 gc_idle_time_handler_->ShouldDoOverApproximateWeakClosure( | 4209 gc_idle_time_handler_->ShouldDoOverApproximateWeakClosure( |
4205 idle_time_in_ms))) { | 4210 idle_time_in_ms))) { |
4206 FinalizeIncrementalMarking(gc_reason); | 4211 FinalizeIncrementalMarking(gc_reason); |
4207 return true; | 4212 return true; |
4208 } else if (incremental_marking()->IsComplete() || | 4213 } else if (incremental_marking()->IsComplete() || |
4209 (MarkingDequesAreEmpty() && | 4214 (mark_compact_collector()->marking_deque()->IsEmpty() && |
| 4215 local_embedder_heap_tracer() |
| 4216 ->ShouldFinalizeIncrementalMarking() && |
4210 gc_idle_time_handler_->ShouldDoFinalIncrementalMarkCompact( | 4217 gc_idle_time_handler_->ShouldDoFinalIncrementalMarkCompact( |
4211 idle_time_in_ms, size_of_objects, | 4218 idle_time_in_ms, size_of_objects, |
4212 final_incremental_mark_compact_speed_in_bytes_per_ms))) { | 4219 final_incremental_mark_compact_speed_in_bytes_per_ms))) { |
4213 CollectAllGarbage(current_gc_flags_, gc_reason); | 4220 CollectAllGarbage(current_gc_flags_, gc_reason); |
4214 return true; | 4221 return true; |
4215 } | 4222 } |
4216 return false; | 4223 return false; |
4217 } | 4224 } |
4218 | 4225 |
4219 void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) { | 4226 void Heap::RegisterReservationsForBlackAllocation(Reservation* reservations) { |
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6499 } | 6506 } |
6500 | 6507 |
6501 | 6508 |
6502 // static | 6509 // static |
6503 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6510 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6504 return StaticVisitorBase::GetVisitorId(map); | 6511 return StaticVisitorBase::GetVisitorId(map); |
6505 } | 6512 } |
6506 | 6513 |
6507 } // namespace internal | 6514 } // namespace internal |
6508 } // namespace v8 | 6515 } // namespace v8 |
OLD | NEW |