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 Linux goes here. For the POSIX-compatible | 5 // Platform-specific code for Linux 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 <pthread.h> | 8 #include <pthread.h> |
9 #include <semaphore.h> | 9 #include <semaphore.h> |
10 #include <signal.h> | 10 #include <signal.h> |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 } | 303 } |
304 | 304 |
305 | 305 |
306 void VirtualMemory::Reset() { | 306 void VirtualMemory::Reset() { |
307 address_ = NULL; | 307 address_ = NULL; |
308 size_ = 0; | 308 size_ = 0; |
309 } | 309 } |
310 | 310 |
311 | 311 |
312 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) { | 312 bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) { |
| 313 CHECK(InVM(address, size)); |
313 return CommitRegion(address, size, is_executable); | 314 return CommitRegion(address, size, is_executable); |
314 } | 315 } |
315 | 316 |
316 | 317 |
317 bool VirtualMemory::Uncommit(void* address, size_t size) { | 318 bool VirtualMemory::Uncommit(void* address, size_t size) { |
| 319 CHECK(InVM(address, size)); |
318 return UncommitRegion(address, size); | 320 return UncommitRegion(address, size); |
319 } | 321 } |
320 | 322 |
321 | 323 |
322 bool VirtualMemory::Guard(void* address) { | 324 bool VirtualMemory::Guard(void* address) { |
| 325 CHECK(InVM(address, OS::CommitPageSize())); |
323 OS::Guard(address, OS::CommitPageSize()); | 326 OS::Guard(address, OS::CommitPageSize()); |
324 return true; | 327 return true; |
325 } | 328 } |
326 | 329 |
327 | 330 |
328 void* VirtualMemory::ReserveRegion(size_t size) { | 331 void* VirtualMemory::ReserveRegion(size_t size) { |
329 void* result = mmap(OS::GetRandomMmapAddr(), | 332 void* result = mmap(OS::GetRandomMmapAddr(), |
330 size, | 333 size, |
331 PROT_NONE, | 334 PROT_NONE, |
332 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, | 335 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 #endif | 382 #endif |
380 return munmap(base, size) == 0; | 383 return munmap(base, size) == 0; |
381 } | 384 } |
382 | 385 |
383 | 386 |
384 bool VirtualMemory::HasLazyCommits() { | 387 bool VirtualMemory::HasLazyCommits() { |
385 return true; | 388 return true; |
386 } | 389 } |
387 | 390 |
388 } } // namespace v8::base | 391 } } // namespace v8::base |
OLD | NEW |