| 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 #ifndef VM_VIRTUAL_MEMORY_H_ | 5 #ifndef VM_VIRTUAL_MEMORY_H_ |
| 6 #define VM_VIRTUAL_MEMORY_H_ | 6 #define VM_VIRTUAL_MEMORY_H_ |
| 7 | 7 |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/memory_region.h" | 10 #include "vm/memory_region.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 static VirtualMemory* ReserveAligned(intptr_t size, intptr_t alignment); | 55 static VirtualMemory* ReserveAligned(intptr_t size, intptr_t alignment); |
| 56 | 56 |
| 57 static intptr_t PageSize() { | 57 static intptr_t PageSize() { |
| 58 ASSERT(page_size_ != 0); | 58 ASSERT(page_size_ != 0); |
| 59 ASSERT(Utils::IsPowerOfTwo(page_size_)); | 59 ASSERT(Utils::IsPowerOfTwo(page_size_)); |
| 60 return page_size_; | 60 return page_size_; |
| 61 } | 61 } |
| 62 | 62 |
| 63 static bool InSamePage(uword address0, uword address1); | 63 static bool InSamePage(uword address0, uword address1); |
| 64 | 64 |
| 65 private: | |
| 66 // Truncate this virtual memory segment. | 65 // Truncate this virtual memory segment. |
| 67 void Truncate(uword new_start, intptr_t size); | 66 void Truncate(uword new_start, intptr_t size); |
| 68 | 67 |
| 68 private: |
| 69 // Free a sub segment. On operating systems that support it this | 69 // Free a sub segment. On operating systems that support it this |
| 70 // can give back the virtual memory to the system. | 70 // can give back the virtual memory to the system. |
| 71 void FreeSubSegment(void* address, intptr_t size); | 71 void FreeSubSegment(void* address, intptr_t size); |
| 72 | 72 |
| 73 // This constructor is only used internally when reserving new virtual spaces. | 73 // This constructor is only used internally when reserving new virtual spaces. |
| 74 // It does not reserve any virtual address space on its own. | 74 // It does not reserve any virtual address space on its own. |
| 75 VirtualMemory(const MemoryRegion& region, void* reserved_pointer) : | 75 VirtualMemory(const MemoryRegion& region, void* reserved_pointer) : |
| 76 region_(region.pointer(), region.size()), | 76 region_(region.pointer(), region.size()), |
| 77 reserved_pointer_(reserved_pointer) { } | 77 reserved_pointer_(reserved_pointer) { } |
| 78 | 78 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 90 void* reserved_pointer_; | 90 void* reserved_pointer_; |
| 91 | 91 |
| 92 static uword page_size_; | 92 static uword page_size_; |
| 93 | 93 |
| 94 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory); | 94 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace dart | 97 } // namespace dart |
| 98 | 98 |
| 99 #endif // VM_VIRTUAL_MEMORY_H_ | 99 #endif // VM_VIRTUAL_MEMORY_H_ |
| OLD | NEW |