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 Solaris 10 goes here. For the POSIX-compatible | 5 // Platform-specific code for Solaris 10 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 #ifdef __sparc | 8 #ifdef __sparc |
9 # error "V8 does not support the SPARC CPU architecture." | 9 # error "V8 does not support the SPARC CPU architecture." |
10 #endif | 10 #endif |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 | 73 |
74 void* OS::Allocate(const size_t requested, | 74 void* OS::Allocate(const size_t requested, |
75 size_t* allocated, | 75 size_t* allocated, |
76 bool is_executable) { | 76 bool is_executable) { |
77 const size_t msize = RoundUp(requested, getpagesize()); | 77 const size_t msize = RoundUp(requested, getpagesize()); |
78 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); | 78 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); |
79 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0); | 79 void* mbase = mmap(NULL, msize, prot, MAP_PRIVATE | MAP_ANON, -1, 0); |
80 | 80 |
81 if (mbase == MAP_FAILED) { | 81 if (mbase == MAP_FAILED) return NULL; |
82 LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed")); | |
83 return NULL; | |
84 } | |
85 *allocated = msize; | 82 *allocated = msize; |
86 return mbase; | 83 return mbase; |
87 } | 84 } |
88 | 85 |
89 | 86 |
90 class PosixMemoryMappedFile : public OS::MemoryMappedFile { | 87 class PosixMemoryMappedFile : public OS::MemoryMappedFile { |
91 public: | 88 public: |
92 PosixMemoryMappedFile(FILE* file, void* memory, int size) | 89 PosixMemoryMappedFile(FILE* file, void* memory, int size) |
93 : file_(file), memory_(memory), size_(size) { } | 90 : file_(file), memory_(memory), size_(size) { } |
94 virtual ~PosixMemoryMappedFile(); | 91 virtual ~PosixMemoryMappedFile(); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 return munmap(base, size) == 0; | 308 return munmap(base, size) == 0; |
312 } | 309 } |
313 | 310 |
314 | 311 |
315 bool VirtualMemory::HasLazyCommits() { | 312 bool VirtualMemory::HasLazyCommits() { |
316 // TODO(alph): implement for the platform. | 313 // TODO(alph): implement for the platform. |
317 return false; | 314 return false; |
318 } | 315 } |
319 | 316 |
320 } } // namespace v8::internal | 317 } } // namespace v8::internal |
OLD | NEW |