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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 set_top(result + size); | 51 set_top(result + size); |
52 return result; | 52 return result; |
53 } | 53 } |
54 | 54 |
55 void VisitObjects(ObjectVisitor* visitor) const; | 55 void VisitObjects(ObjectVisitor* visitor) const; |
56 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 56 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
57 | 57 |
58 RawObject* FindObject(FindObjectVisitor* visitor) const; | 58 RawObject* FindObject(FindObjectVisitor* visitor) const; |
59 | 59 |
| 60 void WriteProtect(bool read_only); |
| 61 |
60 private: | 62 private: |
61 static HeapPage* Initialize(VirtualMemory* memory, bool is_executable); | 63 static HeapPage* Initialize(VirtualMemory* memory, bool is_executable); |
62 static HeapPage* Allocate(intptr_t size, bool is_executable); | 64 static HeapPage* Allocate(intptr_t size, bool is_executable); |
63 | 65 |
64 // Deallocate the virtual memory backing this page. The page pointer to this | 66 // Deallocate the virtual memory backing this page. The page pointer to this |
65 // page becomes immediately inaccessible. | 67 // page becomes immediately inaccessible. |
66 void Deallocate(); | 68 void Deallocate(); |
67 | 69 |
68 VirtualMemory* memory_; | 70 VirtualMemory* memory_; |
69 HeapPage* next_; | 71 HeapPage* next_; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return reinterpret_cast<HeapPage*>( | 188 return reinterpret_cast<HeapPage*>( |
187 RawObject::ToAddr(raw_obj) & ~(kPageSize -1)); | 189 RawObject::ToAddr(raw_obj) & ~(kPageSize -1)); |
188 } | 190 } |
189 | 191 |
190 void StartEndAddress(uword* start, uword* end) const; | 192 void StartEndAddress(uword* start, uword* end) const; |
191 | 193 |
192 void EnableGrowthControl() { | 194 void EnableGrowthControl() { |
193 page_space_controller_.Enable(); | 195 page_space_controller_.Enable(); |
194 } | 196 } |
195 | 197 |
| 198 void WriteProtect(bool read_only); |
| 199 |
196 private: | 200 private: |
197 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); | 201 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); |
198 | 202 |
199 void AllocatePage(); | 203 void AllocatePage(); |
200 void FreePage(HeapPage* page, HeapPage* previous_page); | 204 void FreePage(HeapPage* page, HeapPage* previous_page); |
201 HeapPage* AllocateLargePage(intptr_t size); | 205 HeapPage* AllocateLargePage(intptr_t size); |
202 void FreeLargePage(HeapPage* page, HeapPage* previous_page); | 206 void FreeLargePage(HeapPage* page, HeapPage* previous_page); |
203 void FreePages(HeapPage* pages); | 207 void FreePages(HeapPage* pages); |
204 | 208 |
205 static intptr_t LargePageSizeFor(intptr_t size); | 209 static intptr_t LargePageSizeFor(intptr_t size); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 bool sweeping_; | 244 bool sweeping_; |
241 | 245 |
242 PageSpaceController page_space_controller_; | 246 PageSpaceController page_space_controller_; |
243 | 247 |
244 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 248 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
245 }; | 249 }; |
246 | 250 |
247 } // namespace dart | 251 } // namespace dart |
248 | 252 |
249 #endif // VM_PAGES_H_ | 253 #endif // VM_PAGES_H_ |
OLD | NEW |