OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #ifndef VM_PAGES_H_ | 5 #ifndef VM_PAGES_H_ |
6 #define VM_PAGES_H_ | 6 #define VM_PAGES_H_ |
7 | 7 |
8 #include "vm/freelist.h" | 8 #include "vm/freelist.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/virtual_memory.h" | 10 #include "vm/virtual_memory.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 bool IsValidAddress(uword addr) const { | 80 bool IsValidAddress(uword addr) const { |
81 return Contains(addr); | 81 return Contains(addr); |
82 } | 82 } |
83 static bool IsPageAllocatableSize(intptr_t size) { | 83 static bool IsPageAllocatableSize(intptr_t size) { |
84 return size <= kAllocatablePageSize; | 84 return size <= kAllocatablePageSize; |
85 } | 85 } |
86 | 86 |
87 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 87 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
88 | 88 |
89 // Collect the garbage in the page space using mark-sweep. | 89 // Collect the garbage in the page space using mark-sweep. |
90 void MarkSweep(); | 90 void MarkSweep(bool invoke_api_callbacks); |
91 | 91 |
92 static HeapPage* PageFor(RawObject* raw_obj) { | 92 static HeapPage* PageFor(RawObject* raw_obj) { |
93 return reinterpret_cast<HeapPage*>( | 93 return reinterpret_cast<HeapPage*>( |
94 RawObject::ToAddr(raw_obj) & ~(kPageSize -1)); | 94 RawObject::ToAddr(raw_obj) & ~(kPageSize -1)); |
95 } | 95 } |
96 | 96 |
97 private: | 97 private: |
98 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); | 98 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); |
99 | 99 |
100 void AllocatePage(); | 100 void AllocatePage(); |
(...skipping 29 matching lines...) Expand all Loading... |
130 | 130 |
131 // Keep track whether a MarkSweep is currently running. | 131 // Keep track whether a MarkSweep is currently running. |
132 bool sweeping_; | 132 bool sweeping_; |
133 | 133 |
134 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 134 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
135 }; | 135 }; |
136 | 136 |
137 } // namespace dart | 137 } // namespace dart |
138 | 138 |
139 #endif // VM_PAGES_H_ | 139 #endif // VM_PAGES_H_ |
OLD | NEW |