| 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 #include <cmath> |
| 27 | 27 |
| 28 #undef MAP_TYPE | 28 #undef MAP_TYPE |
| 29 | 29 |
| 30 #include "src/platform.h" | 30 #include "src/base/macros.h" |
| 31 #include "src/utils.h" | 31 #include "src/base/platform/platform.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 |
| 42 // versions of zero. | 42 // versions of zero. |
| 43 if (x == 0) { | 43 if (x == 0) { |
| 44 return fpclass(x) & FP_NZERO; | 44 return fpclass(x) & FP_NZERO; |
| 45 } else { | 45 } else { |
| 46 // This won't detect negative NaN but that should be okay since we don't | 46 // This won't detect negative NaN but that should be okay since we don't |
| 47 // assume that behavior. | 47 // assume that behavior. |
| 48 return x < 0; | 48 return x < 0; |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 } // namespace std | 51 } // namespace std |
| 52 #endif // signbit | 52 #endif // signbit |
| 53 | 53 |
| 54 namespace v8 { | 54 namespace v8 { |
| 55 namespace internal { | 55 namespace base { |
| 56 | 56 |
| 57 | 57 |
| 58 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { | 58 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
| 59 if (std::isnan(time)) return ""; | 59 if (std::isnan(time)) return ""; |
| 60 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 60 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
| 61 struct tm* t = localtime(&tv); | 61 struct tm* t = localtime(&tv); |
| 62 if (NULL == t) return ""; | 62 if (NULL == t) return ""; |
| 63 return tzname[0]; // The location of the timezone string on Solaris. | 63 return tzname[0]; // The location of the timezone string on Solaris. |
| 64 } | 64 } |
| 65 | 65 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { | 269 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { |
| 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::base |
| OLD | NEW |