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/verified_memory.h" |
14 #include "vm/virtual_memory.h" | 15 #include "vm/virtual_memory.h" |
15 | 16 |
16 namespace dart { | 17 namespace dart { |
17 | 18 |
18 DEFINE_FLAG(int, heap_growth_rate, 0, | 19 DEFINE_FLAG(int, heap_growth_rate, 0, |
19 "The max number of pages the heap can grow at a time"); | 20 "The max number of pages the heap can grow at a time"); |
20 DEFINE_FLAG(int, old_gen_growth_space_ratio, 20, | 21 DEFINE_FLAG(int, old_gen_growth_space_ratio, 20, |
21 "The desired maximum percentage of free space after old gen GC"); | 22 "The desired maximum percentage of free space after old gen GC"); |
22 DEFINE_FLAG(int, old_gen_growth_time_ratio, 3, | 23 DEFINE_FLAG(int, old_gen_growth_time_ratio, 3, |
23 "The desired maximum percentage of time spent in old gen GC"); | 24 "The desired maximum percentage of time spent in old gen GC"); |
(...skipping 28 matching lines...) Expand all Loading... |
52 HeapPage* result = reinterpret_cast<HeapPage*>(memory->address()); | 53 HeapPage* result = reinterpret_cast<HeapPage*>(memory->address()); |
53 result->memory_ = memory; | 54 result->memory_ = memory; |
54 result->next_ = NULL; | 55 result->next_ = NULL; |
55 result->executable_ = is_executable; | 56 result->executable_ = is_executable; |
56 return result; | 57 return result; |
57 } | 58 } |
58 | 59 |
59 | 60 |
60 HeapPage* HeapPage::Allocate(intptr_t size_in_words, PageType type) { | 61 HeapPage* HeapPage::Allocate(intptr_t size_in_words, PageType type) { |
61 VirtualMemory* memory = | 62 VirtualMemory* memory = |
62 VirtualMemory::Reserve(size_in_words << kWordSizeLog2); | 63 VerifiedMemory::Reserve(size_in_words << kWordSizeLog2); |
63 return Initialize(memory, type); | 64 return Initialize(memory, type); |
64 } | 65 } |
65 | 66 |
66 | 67 |
67 void HeapPage::Deallocate() { | 68 void HeapPage::Deallocate() { |
68 // The memory for this object will become unavailable after the delete below. | 69 // The memory for this object will become unavailable after the delete below. |
69 delete memory_; | 70 delete memory_; |
70 } | 71 } |
71 | 72 |
72 | 73 |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 return 0; | 1001 return 0; |
1001 } else { | 1002 } else { |
1002 ASSERT(total_time >= gc_time); | 1003 ASSERT(total_time >= gc_time); |
1003 int result= static_cast<int>((static_cast<double>(gc_time) / | 1004 int result= static_cast<int>((static_cast<double>(gc_time) / |
1004 static_cast<double>(total_time)) * 100); | 1005 static_cast<double>(total_time)) * 100); |
1005 return result; | 1006 return result; |
1006 } | 1007 } |
1007 } | 1008 } |
1008 | 1009 |
1009 } // namespace dart | 1010 } // namespace dart |
OLD | NEW |