| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 static VirtualMemory* ReserveInternal(intptr_t size); | 77 static VirtualMemory* ReserveInternal(intptr_t size); |
| 78 | 78 |
| 79 // Free a sub segment. On operating systems that support it this | 79 // Free a sub segment. On operating systems that support it this |
| 80 // can give back the virtual memory to the system. Returns true on success. | 80 // can give back the virtual memory to the system. Returns true on success. |
| 81 static bool FreeSubSegment(void* address, intptr_t size); | 81 static bool FreeSubSegment(void* address, intptr_t size); |
| 82 | 82 |
| 83 // This constructor is only used internally when reserving new virtual spaces. | 83 // This constructor is only used internally when reserving new virtual spaces. |
| 84 // It does not reserve any virtual address space on its own. | 84 // It does not reserve any virtual address space on its own. |
| 85 explicit VirtualMemory(const MemoryRegion& region) : | 85 explicit VirtualMemory(const MemoryRegion& region) : |
| 86 region_(region.pointer(), region.size()), | 86 region_(region.pointer(), region.size()), |
| 87 reserved_size_(region.size()) { } | 87 reserved_size_(region.size()), |
| 88 embedder_allocated_(false) { } |
| 88 | 89 |
| 89 MemoryRegion region_; | 90 MemoryRegion region_; |
| 90 | 91 |
| 91 // The size of the underlying reservation not yet given back to the OS. | 92 // The size of the underlying reservation not yet given back to the OS. |
| 92 // Its start coincides with region_, but its size might not, due to Truncate. | 93 // Its start coincides with region_, but its size might not, due to Truncate. |
| 93 intptr_t reserved_size_; | 94 intptr_t reserved_size_; |
| 94 | 95 |
| 95 static uword page_size_; | 96 static uword page_size_; |
| 96 | 97 |
| 97 // True for a region provided by the embedder. | 98 // True for a region provided by the embedder. |
| 98 bool embedder_allocated_; | 99 bool embedder_allocated_; |
| 99 | 100 |
| 100 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory); | 101 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory); |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 } // namespace dart | 104 } // namespace dart |
| 104 | 105 |
| 105 #endif // VM_VIRTUAL_MEMORY_H_ | 106 #endif // VM_VIRTUAL_MEMORY_H_ |
| OLD | NEW |