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/os_thread.h" | 13 #include "vm/os_thread.h" |
14 #include "vm/safepoint.h" | 14 #include "vm/safepoint.h" |
15 #include "vm/verified_memory.h" | 15 #include "vm/verified_memory.h" |
16 #include "vm/virtual_memory.h" | 16 #include "vm/virtual_memory.h" |
17 | 17 |
18 namespace dart { | 18 namespace dart { |
19 | 19 |
20 // Disable concurrent sweeping by default on armv5te. The relevant | |
21 // implementations are uniprocessors. | |
22 #if defined(TARGET_ARCH_ARM_5TE) | |
23 #define USING_CONCURRENT_SWEEP false | |
24 #else | |
25 #define USING_CONCURRENT_SWEEP true | |
26 #endif | |
27 | |
20 DEFINE_FLAG(int, heap_growth_rate, 0, | 28 DEFINE_FLAG(int, heap_growth_rate, 0, |
21 "The max number of pages the heap can grow at a time"); | 29 "The max number of pages the heap can grow at a time"); |
22 DEFINE_FLAG(int, old_gen_growth_space_ratio, 20, | 30 DEFINE_FLAG(int, old_gen_growth_space_ratio, 20, |
23 "The desired maximum percentage of free space after old gen GC"); | 31 "The desired maximum percentage of free space after old gen GC"); |
24 DEFINE_FLAG(int, old_gen_growth_time_ratio, 3, | 32 DEFINE_FLAG(int, old_gen_growth_time_ratio, 3, |
25 "The desired maximum percentage of time spent in old gen GC"); | 33 "The desired maximum percentage of time spent in old gen GC"); |
26 DEFINE_FLAG(int, old_gen_growth_rate, 280, | 34 DEFINE_FLAG(int, old_gen_growth_rate, 280, |
27 "The max number of pages the old generation can grow at a time"); | 35 "The max number of pages the old generation can grow at a time"); |
28 DEFINE_FLAG(bool, print_free_list_before_gc, false, | 36 DEFINE_FLAG(bool, print_free_list_before_gc, false, |
29 "Print free list statistics before a GC"); | 37 "Print free list statistics before a GC"); |
30 DEFINE_FLAG(bool, print_free_list_after_gc, false, | 38 DEFINE_FLAG(bool, print_free_list_after_gc, false, |
31 "Print free list statistics after a GC"); | 39 "Print free list statistics after a GC"); |
32 DEFINE_FLAG(int, code_collection_interval_in_us, 30000000, | 40 DEFINE_FLAG(int, code_collection_interval_in_us, 30000000, |
33 "Time between attempts to collect unused code."); | 41 "Time between attempts to collect unused code."); |
34 DEFINE_FLAG(bool, log_code_drop, false, | 42 DEFINE_FLAG(bool, log_code_drop, false, |
35 "Emit a log message when pointers to unused code are dropped."); | 43 "Emit a log message when pointers to unused code are dropped."); |
36 DEFINE_FLAG(bool, always_drop_code, false, | 44 DEFINE_FLAG(bool, always_drop_code, false, |
37 "Always try to drop code if the function's usage counter is >= 0"); | 45 "Always try to drop code if the function's usage counter is >= 0"); |
38 DEFINE_FLAG(bool, concurrent_sweep, true, | 46 DEFINE_FLAG(bool, concurrent_sweep, USING_CONCURRENT_SWEEP, |
Ivan Posva
2016/05/12 17:19:46
ditto
zra
2016/05/12 19:54:21
Done.
zra
2016/05/12 19:59:11
That is, I moved concurrent_sweep. Moving the othe
| |
39 "Concurrent sweep for old generation."); | 47 "Concurrent sweep for old generation."); |
40 DEFINE_FLAG(bool, log_growth, false, "Log PageSpace growth policy decisions."); | 48 DEFINE_FLAG(bool, log_growth, false, "Log PageSpace growth policy decisions."); |
41 | 49 |
42 HeapPage* HeapPage::Initialize(VirtualMemory* memory, PageType type) { | 50 HeapPage* HeapPage::Initialize(VirtualMemory* memory, PageType type) { |
43 ASSERT(memory != NULL); | 51 ASSERT(memory != NULL); |
44 ASSERT(memory->size() > VirtualMemory::PageSize()); | 52 ASSERT(memory->size() > VirtualMemory::PageSize()); |
45 bool is_executable = (type == kExecutable); | 53 bool is_executable = (type == kExecutable); |
46 // Create the new page executable (RWX) only if we're not in W^X mode | 54 // Create the new page executable (RWX) only if we're not in W^X mode |
47 bool create_executable = !FLAG_write_protect_code && is_executable; | 55 bool create_executable = !FLAG_write_protect_code && is_executable; |
48 if (!memory->Commit(create_executable)) { | 56 if (!memory->Commit(create_executable)) { |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1236 return 0; | 1244 return 0; |
1237 } else { | 1245 } else { |
1238 ASSERT(total_time >= gc_time); | 1246 ASSERT(total_time >= gc_time); |
1239 int result = static_cast<int>((static_cast<double>(gc_time) / | 1247 int result = static_cast<int>((static_cast<double>(gc_time) / |
1240 static_cast<double>(total_time)) * 100); | 1248 static_cast<double>(total_time)) * 100); |
1241 return result; | 1249 return result; |
1242 } | 1250 } |
1243 } | 1251 } |
1244 | 1252 |
1245 } // namespace dart | 1253 } // namespace dart |
OLD | NEW |