| 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 |
| 11 | 11 |
| 12 #include <dlfcn.h> // dladdr | 12 #include <dlfcn.h> // dladdr |
| 13 #include <errno.h> | 13 #include <errno.h> |
| 14 #include <ieeefp.h> // finite() | 14 #include <ieeefp.h> // finite() |
| 15 #include <pthread.h> | 15 #include <pthread.h> |
| 16 #include <semaphore.h> | 16 #include <semaphore.h> |
| 17 #include <signal.h> // sigemptyset(), etc | 17 #include <signal.h> // sigemptyset(), etc |
| 18 #include <sys/mman.h> // mmap() | 18 #include <sys/mman.h> // mmap() |
| 19 #include <sys/regset.h> | 19 #include <sys/regset.h> |
| 20 #include <sys/stack.h> // for stack alignment | 20 #include <sys/stack.h> // for stack alignment |
| 21 #include <sys/time.h> // gettimeofday(), timeradd() | 21 #include <sys/time.h> // gettimeofday(), timeradd() |
| 22 #include <time.h> | 22 #include <time.h> |
| 23 #include <ucontext.h> // walkstack(), getcontext() | 23 #include <ucontext.h> // walkstack(), getcontext() |
| 24 #include <unistd.h> // getpagesize(), usleep() | 24 #include <unistd.h> // getpagesize(), usleep() |
| 25 | 25 |
| 26 #include <cmath> |
| 26 | 27 |
| 27 #undef MAP_TYPE | 28 #undef MAP_TYPE |
| 28 | 29 |
| 29 #include "src/v8.h" | |
| 30 | |
| 31 #include "src/platform.h" | 30 #include "src/platform.h" |
| 31 #include "src/utils.h" |
| 32 | 32 |
| 33 | 33 |
| 34 // It seems there is a bug in some Solaris distributions (experienced in | 34 // It seems there is a bug in some Solaris distributions (experienced in |
| 35 // SunOS 5.10 Generic_141445-09) which make it difficult or impossible to | 35 // SunOS 5.10 Generic_141445-09) which make it difficult or impossible to |
| 36 // access signbit() despite the availability of other C99 math functions. | 36 // access signbit() despite the availability of other C99 math functions. |
| 37 #ifndef signbit | 37 #ifndef signbit |
| 38 namespace std { | 38 namespace std { |
| 39 // Test sign - usually defined in math.h | 39 // Test sign - usually defined in math.h |
| 40 int signbit(double x) { | 40 int signbit(double x) { |
| 41 // We need to take care of the special case of both positive and negative | 41 // We need to take care of the special case of both positive and negative |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 size_t request_size = RoundUp(size + alignment, | 158 size_t request_size = RoundUp(size + alignment, |
| 159 static_cast<intptr_t>(OS::AllocateAlignment())); | 159 static_cast<intptr_t>(OS::AllocateAlignment())); |
| 160 void* reservation = mmap(OS::GetRandomMmapAddr(), | 160 void* reservation = mmap(OS::GetRandomMmapAddr(), |
| 161 request_size, | 161 request_size, |
| 162 PROT_NONE, | 162 PROT_NONE, |
| 163 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, | 163 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, |
| 164 kMmapFd, | 164 kMmapFd, |
| 165 kMmapFdOffset); | 165 kMmapFdOffset); |
| 166 if (reservation == MAP_FAILED) return; | 166 if (reservation == MAP_FAILED) return; |
| 167 | 167 |
| 168 Address base = static_cast<Address>(reservation); | 168 uint8_t* base = static_cast<uint8_t*>(reservation); |
| 169 Address aligned_base = RoundUp(base, alignment); | 169 uint8_t* aligned_base = RoundUp(base, alignment); |
| 170 ASSERT_LE(base, aligned_base); | 170 ASSERT_LE(base, aligned_base); |
| 171 | 171 |
| 172 // Unmap extra memory reserved before and after the desired block. | 172 // Unmap extra memory reserved before and after the desired block. |
| 173 if (aligned_base != base) { | 173 if (aligned_base != base) { |
| 174 size_t prefix_size = static_cast<size_t>(aligned_base - base); | 174 size_t prefix_size = static_cast<size_t>(aligned_base - base); |
| 175 OS::Free(base, prefix_size); | 175 OS::Free(base, prefix_size); |
| 176 request_size -= prefix_size; | 176 request_size -= prefix_size; |
| 177 } | 177 } |
| 178 | 178 |
| 179 size_t aligned_size = RoundUp(size, OS::AllocateAlignment()); | 179 size_t aligned_size = RoundUp(size, OS::AllocateAlignment()); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 return munmap(base, size) == 0; | 270 return munmap(base, size) == 0; |
| 271 } | 271 } |
| 272 | 272 |
| 273 | 273 |
| 274 bool VirtualMemory::HasLazyCommits() { | 274 bool VirtualMemory::HasLazyCommits() { |
| 275 // TODO(alph): implement for the platform. | 275 // TODO(alph): implement for the platform. |
| 276 return false; | 276 return false; |
| 277 } | 277 } |
| 278 | 278 |
| 279 } } // namespace v8::internal | 279 } } // namespace v8::internal |
| OLD | NEW |