| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Platform-specific code for MacOS goes here. For the POSIX-compatible | 5 // Platform-specific code for MacOS goes here. For the POSIX-compatible |
| 6 // parts, the implementation is in platform-posix.cc. | 6 // parts, the implementation is in platform-posix.cc. |
| 7 | 7 |
| 8 #include <dlfcn.h> | 8 #include <dlfcn.h> |
| 9 #include <mach/mach_init.h> | 9 #include <mach/mach_init.h> |
| 10 #include <mach-o/dyld.h> | 10 #include <mach-o/dyld.h> |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 | 168 |
| 169 VirtualMemory::~VirtualMemory() { | 169 VirtualMemory::~VirtualMemory() { |
| 170 if (IsReserved()) { | 170 if (IsReserved()) { |
| 171 bool result = ReleaseRegion(address(), size()); | 171 bool result = ReleaseRegion(address(), size()); |
| 172 DCHECK(result); | 172 DCHECK(result); |
| 173 USE(result); | 173 USE(result); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 | 177 bool VirtualMemory::IsReserved() const { return address_ != NULL; } |
| 178 bool VirtualMemory::IsReserved() { | |
| 179 return address_ != NULL; | |
| 180 } | |
| 181 | |
| 182 | 178 |
| 183 void VirtualMemory::Reset() { | 179 void VirtualMemory::Reset() { |
| 184 address_ = NULL; | 180 address_ = NULL; |
| 185 size_ = 0; | 181 size_ = 0; |
| 186 } | 182 } |
| 187 | 183 |
| 188 | 184 |
| 189 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) { | 185 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) { |
| 190 return CommitRegion(address, size, is_executable); | 186 return CommitRegion(address, size, is_executable); |
| 191 } | 187 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 243 } |
| 248 | 244 |
| 249 bool VirtualMemory::ReleaseRegion(void* address, size_t size) { | 245 bool VirtualMemory::ReleaseRegion(void* address, size_t size) { |
| 250 return munmap(address, size) == 0; | 246 return munmap(address, size) == 0; |
| 251 } | 247 } |
| 252 | 248 |
| 253 bool VirtualMemory::HasLazyCommits() { return true; } | 249 bool VirtualMemory::HasLazyCommits() { return true; } |
| 254 | 250 |
| 255 } // namespace base | 251 } // namespace base |
| 256 } // namespace v8 | 252 } // namespace v8 |
| OLD | NEW |