| 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/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 4604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4615 | 4615 |
| 4616 if (ShouldReduceMemory() || | 4616 if (ShouldReduceMemory() || |
| 4617 ((allocation_throughput != 0) && | 4617 ((allocation_throughput != 0) && |
| 4618 (allocation_throughput < kLowAllocationThroughput))) { | 4618 (allocation_throughput < kLowAllocationThroughput))) { |
| 4619 new_space_.Shrink(); | 4619 new_space_.Shrink(); |
| 4620 UncommitFromSpace(); | 4620 UncommitFromSpace(); |
| 4621 } | 4621 } |
| 4622 } | 4622 } |
| 4623 | 4623 |
| 4624 | 4624 |
| 4625 void Heap::FinalizeIncrementalMarkingIfComplete(const char* comment) { |
| 4626 if (FLAG_overapproximate_weak_closure && incremental_marking()->IsMarking() && |
| 4627 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
| 4628 (!incremental_marking()->weak_closure_was_overapproximated() && |
| 4629 mark_compact_collector_.marking_deque()->IsEmpty()))) { |
| 4630 OverApproximateWeakClosure(comment); |
| 4631 } else if (incremental_marking()->IsComplete() || |
| 4632 (mark_compact_collector_.marking_deque()->IsEmpty())) { |
| 4633 CollectAllGarbage(current_gc_flags_, comment); |
| 4634 } |
| 4635 } |
| 4636 |
| 4637 |
| 4625 bool Heap::TryFinalizeIdleIncrementalMarking( | 4638 bool Heap::TryFinalizeIdleIncrementalMarking( |
| 4626 double idle_time_in_ms, size_t size_of_objects, | 4639 double idle_time_in_ms, size_t size_of_objects, |
| 4627 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { | 4640 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { |
| 4628 if (FLAG_overapproximate_weak_closure && | 4641 if (FLAG_overapproximate_weak_closure && incremental_marking()->IsMarking() && |
| 4629 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || | 4642 (incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
| 4630 (!incremental_marking()->weak_closure_was_overapproximated() && | 4643 (!incremental_marking()->weak_closure_was_overapproximated() && |
| 4631 mark_compact_collector_.marking_deque()->IsEmpty() && | 4644 mark_compact_collector_.marking_deque()->IsEmpty() && |
| 4632 gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure( | 4645 gc_idle_time_handler_.ShouldDoOverApproximateWeakClosure( |
| 4633 static_cast<size_t>(idle_time_in_ms))))) { | 4646 static_cast<size_t>(idle_time_in_ms))))) { |
| 4634 OverApproximateWeakClosure( | 4647 OverApproximateWeakClosure( |
| 4635 "Idle notification: overapproximate weak closure"); | 4648 "Idle notification: overapproximate weak closure"); |
| 4636 return true; | 4649 return true; |
| 4637 } else if (incremental_marking()->IsComplete() || | 4650 } else if (incremental_marking()->IsComplete() || |
| 4638 (mark_compact_collector_.marking_deque()->IsEmpty() && | 4651 (mark_compact_collector_.marking_deque()->IsEmpty() && |
| (...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6658 *object_sub_type = "CODE_AGE/" #name; \ | 6671 *object_sub_type = "CODE_AGE/" #name; \ |
| 6659 return true; | 6672 return true; |
| 6660 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6673 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
| 6661 #undef COMPARE_AND_RETURN_NAME | 6674 #undef COMPARE_AND_RETURN_NAME |
| 6662 } | 6675 } |
| 6663 return false; | 6676 return false; |
| 6664 } | 6677 } |
| 6665 | 6678 |
| 6666 } // namespace internal | 6679 } // namespace internal |
| 6667 } // namespace v8 | 6680 } // namespace v8 |
| OLD | NEW |