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 FreeBSD goes here. For the POSIX-compatible | 5 // Platform-specific code for FreeBSD 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 void* OS::Allocate(const size_t requested, | 58 void* OS::Allocate(const size_t requested, |
59 size_t* allocated, | 59 size_t* allocated, |
60 bool executable) { | 60 bool executable) { |
61 const size_t msize = RoundUp(requested, getpagesize()); | 61 const size_t msize = RoundUp(requested, getpagesize()); |
62 int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0); | 62 int prot = PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0); |
63 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0); | 63 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0); |
64 | 64 |
65 if (mbase == MAP_FAILED) { | 65 if (mbase == MAP_FAILED) return NULL; |
66 LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed")); | |
67 return NULL; | |
68 } | |
69 *allocated = msize; | 66 *allocated = msize; |
70 return mbase; | 67 return mbase; |
71 } | 68 } |
72 | 69 |
73 | 70 |
74 class PosixMemoryMappedFile : public OS::MemoryMappedFile { | 71 class PosixMemoryMappedFile : public OS::MemoryMappedFile { |
75 public: | 72 public: |
76 PosixMemoryMappedFile(FILE* file, void* memory, int size) | 73 PosixMemoryMappedFile(FILE* file, void* memory, int size) |
77 : file_(file), memory_(memory), size_(size) { } | 74 : file_(file), memory_(memory), size_(size) { } |
78 virtual ~PosixMemoryMappedFile(); | 75 virtual ~PosixMemoryMappedFile(); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 return munmap(base, size) == 0; | 296 return munmap(base, size) == 0; |
300 } | 297 } |
301 | 298 |
302 | 299 |
303 bool VirtualMemory::HasLazyCommits() { | 300 bool VirtualMemory::HasLazyCommits() { |
304 // TODO(alph): implement for the platform. | 301 // TODO(alph): implement for the platform. |
305 return false; | 302 return false; |
306 } | 303 } |
307 | 304 |
308 } } // namespace v8::internal | 305 } } // namespace v8::internal |
OLD | NEW |