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 <pthread.h> | 8 #include <pthread.h> |
9 #include <semaphore.h> | 9 #include <semaphore.h> |
10 #include <signal.h> | 10 #include <signal.h> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 void* OS::Allocate(const size_t requested, | 107 void* OS::Allocate(const size_t requested, |
108 size_t* allocated, | 108 size_t* allocated, |
109 bool is_executable) { | 109 bool is_executable) { |
110 const size_t msize = RoundUp(requested, AllocateAlignment()); | 110 const size_t msize = RoundUp(requested, AllocateAlignment()); |
111 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); | 111 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); |
112 void* addr = OS::GetRandomMmapAddr(); | 112 void* addr = OS::GetRandomMmapAddr(); |
113 void* mbase = mmap(addr, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); | 113 void* mbase = mmap(addr, msize, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); |
114 if (mbase == MAP_FAILED) { | 114 if (mbase == MAP_FAILED) return NULL; |
115 LOG(i::Isolate::Current(), | |
116 StringEvent("OS::Allocate", "mmap failed")); | |
117 return NULL; | |
118 } | |
119 *allocated = msize; | 115 *allocated = msize; |
120 return mbase; | 116 return mbase; |
121 } | 117 } |
122 | 118 |
123 | 119 |
124 class PosixMemoryMappedFile : public OS::MemoryMappedFile { | 120 class PosixMemoryMappedFile : public OS::MemoryMappedFile { |
125 public: | 121 public: |
126 PosixMemoryMappedFile(FILE* file, void* memory, int size) | 122 PosixMemoryMappedFile(FILE* file, void* memory, int size) |
127 : file_(file), memory_(memory), size_(size) { } | 123 : file_(file), memory_(memory), size_(size) { } |
128 virtual ~PosixMemoryMappedFile(); | 124 virtual ~PosixMemoryMappedFile(); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { | 364 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { |
369 return munmap(base, size) == 0; | 365 return munmap(base, size) == 0; |
370 } | 366 } |
371 | 367 |
372 | 368 |
373 bool VirtualMemory::HasLazyCommits() { | 369 bool VirtualMemory::HasLazyCommits() { |
374 return false; | 370 return false; |
375 } | 371 } |
376 | 372 |
377 } } // namespace v8::internal | 373 } } // namespace v8::internal |
OLD | NEW |