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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Truncate this virtual memory segment. If try_unmap is false, the | 64 // Truncate this virtual memory segment. If try_unmap is false, the |
65 // memory beyond the new end is still accessible, but will be returned | 65 // memory beyond the new end is still accessible, but will be returned |
66 // upon destruction. | 66 // upon destruction. |
67 void Truncate(intptr_t new_size, bool try_unmap = true); | 67 void Truncate(intptr_t new_size, bool try_unmap = true); |
68 | 68 |
69 // Commit a reserved memory area, so that the memory can be accessed. | 69 // Commit a reserved memory area, so that the memory can be accessed. |
70 bool Commit(uword addr, intptr_t size, bool is_executable); | 70 bool Commit(uword addr, intptr_t size, bool is_executable); |
71 | 71 |
72 bool embedder_allocated() const { return embedder_allocated_; } | 72 bool embedder_allocated() const { return embedder_allocated_; } |
73 | 73 |
74 static VirtualMemory* ForInstructionsSnapshot(void* pointer, uword size); | 74 static VirtualMemory* ForExternalPage(void* pointer, uword size); |
75 | 75 |
76 private: | 76 private: |
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. |
(...skipping 12 matching lines...) Expand all Loading... |
97 | 97 |
98 // True for a region provided by the embedder. | 98 // True for a region provided by the embedder. |
99 bool embedder_allocated_; | 99 bool embedder_allocated_; |
100 | 100 |
101 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory); | 101 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory); |
102 }; | 102 }; |
103 | 103 |
104 } // namespace dart | 104 } // namespace dart |
105 | 105 |
106 #endif // VM_VIRTUAL_MEMORY_H_ | 106 #endif // VM_VIRTUAL_MEMORY_H_ |
OLD | NEW |