| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 QNX goes here. For the POSIX-compatible | 5 // Platform-specific code for QNX 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 <backtrace.h> | 8 #include <backtrace.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <semaphore.h> | 10 #include <semaphore.h> |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } | 243 VirtualMemory::VirtualMemory() : address_(NULL), size_(0) { } |
| 244 | 244 |
| 245 | 245 |
| 246 VirtualMemory::VirtualMemory(size_t size) | 246 VirtualMemory::VirtualMemory(size_t size) |
| 247 : address_(ReserveRegion(size)), size_(size) { } | 247 : address_(ReserveRegion(size)), size_(size) { } |
| 248 | 248 |
| 249 | 249 |
| 250 VirtualMemory::VirtualMemory(size_t size, size_t alignment) | 250 VirtualMemory::VirtualMemory(size_t size, size_t alignment) |
| 251 : address_(NULL), size_(0) { | 251 : address_(NULL), size_(0) { |
| 252 DCHECK(IsAligned(alignment, static_cast<intptr_t>(OS::AllocateAlignment()))); | 252 DCHECK((alignment % OS::AllocateAlignment()) == 0); |
| 253 size_t request_size = RoundUp(size + alignment, | 253 size_t request_size = RoundUp(size + alignment, |
| 254 static_cast<intptr_t>(OS::AllocateAlignment())); | 254 static_cast<intptr_t>(OS::AllocateAlignment())); |
| 255 void* reservation = mmap(OS::GetRandomMmapAddr(), | 255 void* reservation = mmap(OS::GetRandomMmapAddr(), |
| 256 request_size, | 256 request_size, |
| 257 PROT_NONE, | 257 PROT_NONE, |
| 258 MAP_PRIVATE | MAP_ANONYMOUS | MAP_LAZY, | 258 MAP_PRIVATE | MAP_ANONYMOUS | MAP_LAZY, |
| 259 kMmapFd, | 259 kMmapFd, |
| 260 kMmapFdOffset); | 260 kMmapFdOffset); |
| 261 if (reservation == MAP_FAILED) return; | 261 if (reservation == MAP_FAILED) return; |
| 262 | 262 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { | 365 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { |
| 366 return munmap(base, size) == 0; | 366 return munmap(base, size) == 0; |
| 367 } | 367 } |
| 368 | 368 |
| 369 | 369 |
| 370 bool VirtualMemory::HasLazyCommits() { | 370 bool VirtualMemory::HasLazyCommits() { |
| 371 return false; | 371 return false; |
| 372 } | 372 } |
| 373 | 373 |
| 374 } } // namespace v8::base | 374 } } // namespace v8::base |
| OLD | NEW |