| 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 Cygwin goes here. For the POSIX-compatible | 5 // Platform-specific code for Cygwin 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 <errno.h> | 8 #include <errno.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <semaphore.h> | 10 #include <semaphore.h> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 (loc->tm_isdst > 0 ? 3600 * msPerSecond : 0)); | 46 (loc->tm_isdst > 0 ? 3600 * msPerSecond : 0)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 | 49 |
| 50 void* OS::Allocate(const size_t requested, | 50 void* OS::Allocate(const size_t requested, |
| 51 size_t* allocated, | 51 size_t* allocated, |
| 52 bool is_executable) { | 52 bool is_executable) { |
| 53 const size_t msize = RoundUp(requested, sysconf(_SC_PAGESIZE)); | 53 const size_t msize = RoundUp(requested, sysconf(_SC_PAGESIZE)); |
| 54 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); | 54 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); |
| 55 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); | 55 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); |
| 56 if (mbase == MAP_FAILED) { | 56 if (mbase == MAP_FAILED) return NULL; |
| 57 LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed")); | |
| 58 return NULL; | |
| 59 } | |
| 60 *allocated = msize; | 57 *allocated = msize; |
| 61 return mbase; | 58 return mbase; |
| 62 } | 59 } |
| 63 | 60 |
| 64 | 61 |
| 65 class PosixMemoryMappedFile : public OS::MemoryMappedFile { | 62 class PosixMemoryMappedFile : public OS::MemoryMappedFile { |
| 66 public: | 63 public: |
| 67 PosixMemoryMappedFile(FILE* file, void* memory, int size) | 64 PosixMemoryMappedFile(FILE* file, void* memory, int size) |
| 68 : file_(file), memory_(memory), size_(size) { } | 65 : file_(file), memory_(memory), size_(size) { } |
| 69 virtual ~PosixMemoryMappedFile(); | 66 virtual ~PosixMemoryMappedFile(); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 return VirtualFree(base, 0, MEM_RELEASE) != 0; | 320 return VirtualFree(base, 0, MEM_RELEASE) != 0; |
| 324 } | 321 } |
| 325 | 322 |
| 326 | 323 |
| 327 bool VirtualMemory::HasLazyCommits() { | 324 bool VirtualMemory::HasLazyCommits() { |
| 328 // TODO(alph): implement for the platform. | 325 // TODO(alph): implement for the platform. |
| 329 return false; | 326 return false; |
| 330 } | 327 } |
| 331 | 328 |
| 332 } } // namespace v8::internal | 329 } } // namespace v8::internal |
| OLD | NEW |