| 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 17 matching lines...) Expand all Loading... |
| 28 uword end() const { return region_.end(); } | 28 uword end() const { return region_.end(); } |
| 29 void* address() const { return region_.pointer(); } | 29 void* address() const { return region_.pointer(); } |
| 30 intptr_t size() const { return region_.size(); } | 30 intptr_t size() const { return region_.size(); } |
| 31 | 31 |
| 32 static void InitOnce(); | 32 static void InitOnce(); |
| 33 | 33 |
| 34 bool Contains(uword addr) const { | 34 bool Contains(uword addr) const { |
| 35 return region_.Contains(addr); | 35 return region_.Contains(addr); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Commits the virtual memory area, which is guaranteed to be zeroed. | 38 // Commits the virtual memory area, which is guaranteed to be zeroed. Returns |
| 39 // true on success and false on failure (e.g., out-of-memory). |
| 39 bool Commit(bool is_executable) { | 40 bool Commit(bool is_executable) { |
| 40 return Commit(start(), size(), is_executable); | 41 return Commit(start(), size(), is_executable); |
| 41 } | 42 } |
| 42 | 43 |
| 43 // Changes the protection of the virtual memory area. | 44 // Changes the protection of the virtual memory area. |
| 44 static bool Protect(void* address, intptr_t size, Protection mode); | 45 static bool Protect(void* address, intptr_t size, Protection mode); |
| 45 bool Protect(Protection mode) { | 46 bool Protect(Protection mode) { |
| 46 return Protect(address(), size(), mode); | 47 return Protect(address(), size(), mode); |
| 47 } | 48 } |
| 48 | 49 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 intptr_t reserved_size_; | 89 intptr_t reserved_size_; |
| 89 | 90 |
| 90 static uword page_size_; | 91 static uword page_size_; |
| 91 | 92 |
| 92 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory); | 93 DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory); |
| 93 }; | 94 }; |
| 94 | 95 |
| 95 } // namespace dart | 96 } // namespace dart |
| 96 | 97 |
| 97 #endif // VM_VIRTUAL_MEMORY_H_ | 98 #endif // VM_VIRTUAL_MEMORY_H_ |
| OLD | NEW |