| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/pages.h" | 5 #include "vm/pages.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/compiler_stats.h" | 8 #include "vm/compiler_stats.h" |
| 9 #include "vm/gc_marker.h" | 9 #include "vm/gc_marker.h" |
| 10 #include "vm/gc_sweeper.h" | 10 #include "vm/gc_sweeper.h" |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 if (result != 0) { | 873 if (result != 0) { |
| 874 usage_.used_in_words += size >> kWordSizeLog2; | 874 usage_.used_in_words += size >> kWordSizeLog2; |
| 875 return result; | 875 return result; |
| 876 } | 876 } |
| 877 result = TryAllocateDataBumpLocked(size, growth_policy); | 877 result = TryAllocateDataBumpLocked(size, growth_policy); |
| 878 if (result != 0) return result; | 878 if (result != 0) return result; |
| 879 return TryAllocateDataLocked(size, growth_policy); | 879 return TryAllocateDataLocked(size, growth_policy); |
| 880 } | 880 } |
| 881 | 881 |
| 882 | 882 |
| 883 uword PageSpace::TryAllocateSmiInitializedLocked(intptr_t size, |
| 884 GrowthPolicy growth_policy) { |
| 885 uword result = TryAllocateDataBumpLocked(size, growth_policy); |
| 886 if (collections() != 0) { |
| 887 FATAL1("%" Pd " GCs before TryAllocateSmiInitializedLocked", collections()); |
| 888 } |
| 889 #if defined(DEBUG) |
| 890 RawObject** begin = reinterpret_cast<RawObject**>(result); |
| 891 RawObject** end = reinterpret_cast<RawObject**>(result + size); |
| 892 for (RawObject** current = begin; current < end; ++current) { |
| 893 ASSERT(!(*current)->IsHeapObject()); |
| 894 } |
| 895 #endif |
| 896 return result; |
| 897 } |
| 898 |
| 899 |
| 883 PageSpaceController::PageSpaceController(Heap* heap, | 900 PageSpaceController::PageSpaceController(Heap* heap, |
| 884 int heap_growth_ratio, | 901 int heap_growth_ratio, |
| 885 int heap_growth_max, | 902 int heap_growth_max, |
| 886 int garbage_collection_time_ratio) | 903 int garbage_collection_time_ratio) |
| 887 : heap_(heap), | 904 : heap_(heap), |
| 888 is_enabled_(false), | 905 is_enabled_(false), |
| 889 grow_heap_(heap_growth_max / 2), | 906 grow_heap_(heap_growth_max / 2), |
| 890 heap_growth_ratio_(heap_growth_ratio), | 907 heap_growth_ratio_(heap_growth_ratio), |
| 891 desired_utilization_((100.0 - heap_growth_ratio) / 100.0), | 908 desired_utilization_((100.0 - heap_growth_ratio) / 100.0), |
| 892 heap_growth_max_(heap_growth_max), | 909 heap_growth_max_(heap_growth_max), |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 return 0; | 1022 return 0; |
| 1006 } else { | 1023 } else { |
| 1007 ASSERT(total_time >= gc_time); | 1024 ASSERT(total_time >= gc_time); |
| 1008 int result = static_cast<int>((static_cast<double>(gc_time) / | 1025 int result = static_cast<int>((static_cast<double>(gc_time) / |
| 1009 static_cast<double>(total_time)) * 100); | 1026 static_cast<double>(total_time)) * 100); |
| 1010 return result; | 1027 return result; |
| 1011 } | 1028 } |
| 1012 } | 1029 } |
| 1013 | 1030 |
| 1014 } // namespace dart | 1031 } // namespace dart |
| OLD | NEW |