| 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" |
| 11 #include "vm/lockers.h" | 11 #include "vm/lockers.h" |
| 12 #include "vm/object.h" | 12 #include "vm/object.h" |
| 13 #include "vm/thread.h" | 13 #include "vm/thread.h" |
| 14 #include "vm/virtual_memory.h" | 14 #include "vm/virtual_memory.h" |
| 15 | 15 |
| 16 namespace dart { | 16 namespace dart { |
| 17 | 17 |
| 18 DEFINE_FLAG(int, heap_growth_space_ratio, 20, | 18 DEFINE_FLAG(int, heap_growth_rate, 0, |
| 19 "The desired maximum percentage of free space after GC"); | |
| 20 DEFINE_FLAG(int, heap_growth_time_ratio, 3, | |
| 21 "The desired maximum percentage of time spent in GC"); | |
| 22 DEFINE_FLAG(int, heap_growth_rate, 280, | |
| 23 "The max number of pages the heap can grow at a time"); | 19 "The max number of pages the heap can grow at a time"); |
| 20 DEFINE_FLAG(int, old_gen_growth_space_ratio, 20, |
| 21 "The desired maximum percentage of free space after old gen GC"); |
| 22 DEFINE_FLAG(int, old_gen_growth_time_ratio, 3, |
| 23 "The desired maximum percentage of time spent in old gen GC"); |
| 24 DEFINE_FLAG(int, old_gen_growth_rate, 280, |
| 25 "The max number of pages the old generation can grow at a time"); |
| 24 DEFINE_FLAG(bool, print_free_list_before_gc, false, | 26 DEFINE_FLAG(bool, print_free_list_before_gc, false, |
| 25 "Print free list statistics before a GC"); | 27 "Print free list statistics before a GC"); |
| 26 DEFINE_FLAG(bool, print_free_list_after_gc, false, | 28 DEFINE_FLAG(bool, print_free_list_after_gc, false, |
| 27 "Print free list statistics after a GC"); | 29 "Print free list statistics after a GC"); |
| 28 DEFINE_FLAG(bool, collect_code, true, | 30 DEFINE_FLAG(bool, collect_code, true, |
| 29 "Attempt to GC infrequently used code."); | 31 "Attempt to GC infrequently used code."); |
| 30 DEFINE_FLAG(int, code_collection_interval_in_us, 30000000, | 32 DEFINE_FLAG(int, code_collection_interval_in_us, 30000000, |
| 31 "Time between attempts to collect unused code."); | 33 "Time between attempts to collect unused code."); |
| 32 DEFINE_FLAG(bool, log_code_drop, false, | 34 DEFINE_FLAG(bool, log_code_drop, false, |
| 33 "Emit a log message when pointers to unused code are dropped."); | 35 "Emit a log message when pointers to unused code are dropped."); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 pages_tail_(NULL), | 136 pages_tail_(NULL), |
| 135 exec_pages_(NULL), | 137 exec_pages_(NULL), |
| 136 exec_pages_tail_(NULL), | 138 exec_pages_tail_(NULL), |
| 137 large_pages_(NULL), | 139 large_pages_(NULL), |
| 138 bump_top_(0), | 140 bump_top_(0), |
| 139 bump_end_(0), | 141 bump_end_(0), |
| 140 max_capacity_in_words_(max_capacity_in_words), | 142 max_capacity_in_words_(max_capacity_in_words), |
| 141 tasks_lock_(new Monitor()), | 143 tasks_lock_(new Monitor()), |
| 142 tasks_(0), | 144 tasks_(0), |
| 143 page_space_controller_(heap, | 145 page_space_controller_(heap, |
| 144 FLAG_heap_growth_space_ratio, | 146 FLAG_old_gen_growth_space_ratio, |
| 145 FLAG_heap_growth_rate, | 147 FLAG_old_gen_growth_rate, |
| 146 FLAG_heap_growth_time_ratio), | 148 FLAG_old_gen_growth_time_ratio), |
| 147 gc_time_micros_(0), | 149 gc_time_micros_(0), |
| 148 collections_(0) { | 150 collections_(0) { |
| 149 } | 151 } |
| 150 | 152 |
| 151 | 153 |
| 152 PageSpace::~PageSpace() { | 154 PageSpace::~PageSpace() { |
| 153 { | 155 { |
| 154 MonitorLocker ml(tasks_lock()); | 156 MonitorLocker ml(tasks_lock()); |
| 155 while (tasks() > 0) { | 157 while (tasks() > 0) { |
| 156 ml.Wait(); | 158 ml.Wait(); |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 return 0; | 999 return 0; |
| 998 } else { | 1000 } else { |
| 999 ASSERT(total_time >= gc_time); | 1001 ASSERT(total_time >= gc_time); |
| 1000 int result= static_cast<int>((static_cast<double>(gc_time) / | 1002 int result= static_cast<int>((static_cast<double>(gc_time) / |
| 1001 static_cast<double>(total_time)) * 100); | 1003 static_cast<double>(total_time)) * 100); |
| 1002 return result; | 1004 return result; |
| 1003 } | 1005 } |
| 1004 } | 1006 } |
| 1005 | 1007 |
| 1006 } // namespace dart | 1008 } // namespace dart |
| OLD | NEW |