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/v8.h" | 5 #include "src/v8.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 4745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4756 | 4756 |
4757 bool Heap::HasHighFragmentation(intptr_t used, intptr_t committed) { | 4757 bool Heap::HasHighFragmentation(intptr_t used, intptr_t committed) { |
4758 const intptr_t kSlack = 16 * MB; | 4758 const intptr_t kSlack = 16 * MB; |
4759 // Fragmentation is high if committed > 2 * used + kSlack. | 4759 // Fragmentation is high if committed > 2 * used + kSlack. |
4760 // Rewrite the exression to avoid overflow. | 4760 // Rewrite the exression to avoid overflow. |
4761 return committed - used > used + kSlack; | 4761 return committed - used > used + kSlack; |
4762 } | 4762 } |
4763 | 4763 |
4764 | 4764 |
4765 void Heap::ReduceNewSpaceSize() { | 4765 void Heap::ReduceNewSpaceSize() { |
4766 if (!FLAG_predictable && HasLowAllocationRate()) { | 4766 // TODO(ulan): Unify this constant with the similar constant in |
| 4767 // GCIdleTimeHandler once the change is merged to 4.5. |
| 4768 static const size_t kLowAllocationThroughput = 1000; |
| 4769 size_t allocation_throughput = |
| 4770 tracer()->CurrentAllocationThroughputInBytesPerMillisecond(); |
| 4771 if (FLAG_predictable || allocation_throughput == 0) return; |
| 4772 if (allocation_throughput < kLowAllocationThroughput) { |
4767 new_space_.Shrink(); | 4773 new_space_.Shrink(); |
4768 UncommitFromSpace(); | 4774 UncommitFromSpace(); |
4769 } | 4775 } |
4770 } | 4776 } |
4771 | 4777 |
4772 | 4778 |
4773 bool Heap::TryFinalizeIdleIncrementalMarking( | 4779 bool Heap::TryFinalizeIdleIncrementalMarking( |
4774 double idle_time_in_ms, size_t size_of_objects, | 4780 double idle_time_in_ms, size_t size_of_objects, |
4775 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { | 4781 size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { |
4776 if (FLAG_overapproximate_weak_closure && | 4782 if (FLAG_overapproximate_weak_closure && |
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6901 *object_type = "CODE_TYPE"; \ | 6907 *object_type = "CODE_TYPE"; \ |
6902 *object_sub_type = "CODE_AGE/" #name; \ | 6908 *object_sub_type = "CODE_AGE/" #name; \ |
6903 return true; | 6909 return true; |
6904 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6910 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6905 #undef COMPARE_AND_RETURN_NAME | 6911 #undef COMPARE_AND_RETURN_NAME |
6906 } | 6912 } |
6907 return false; | 6913 return false; |
6908 } | 6914 } |
6909 } // namespace internal | 6915 } // namespace internal |
6910 } // namespace v8 | 6916 } // namespace v8 |
OLD | NEW |