| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "platform-posix.h" | 55 #include "platform-posix.h" |
| 56 #include "platform.h" | 56 #include "platform.h" |
| 57 #include "v8threads.h" | 57 #include "v8threads.h" |
| 58 #include "vm-state-inl.h" | 58 #include "vm-state-inl.h" |
| 59 | 59 |
| 60 | 60 |
| 61 // It seems there is a bug in some Solaris distributions (experienced in | 61 // It seems there is a bug in some Solaris distributions (experienced in |
| 62 // SunOS 5.10 Generic_141445-09) which make it difficult or impossible to | 62 // SunOS 5.10 Generic_141445-09) which make it difficult or impossible to |
| 63 // access signbit() despite the availability of other C99 math functions. | 63 // access signbit() despite the availability of other C99 math functions. |
| 64 #ifndef signbit | 64 #ifndef signbit |
| 65 namespace std { |
| 65 // Test sign - usually defined in math.h | 66 // Test sign - usually defined in math.h |
| 66 int signbit(double x) { | 67 int signbit(double x) { |
| 67 // We need to take care of the special case of both positive and negative | 68 // We need to take care of the special case of both positive and negative |
| 68 // versions of zero. | 69 // versions of zero. |
| 69 if (x == 0) { | 70 if (x == 0) { |
| 70 return fpclass(x) & FP_NZERO; | 71 return fpclass(x) & FP_NZERO; |
| 71 } else { | 72 } else { |
| 72 // This won't detect negative NaN but that should be okay since we don't | 73 // This won't detect negative NaN but that should be okay since we don't |
| 73 // assume that behavior. | 74 // assume that behavior. |
| 74 return x < 0; | 75 return x < 0; |
| 75 } | 76 } |
| 76 } | 77 } |
| 78 } // namespace std |
| 77 #endif // signbit | 79 #endif // signbit |
| 78 | 80 |
| 79 namespace v8 { | 81 namespace v8 { |
| 80 namespace internal { | 82 namespace internal { |
| 81 | 83 |
| 82 | 84 |
| 83 // 0 is never a valid thread id on Solaris since the main thread is 1 and | 85 // 0 is never a valid thread id on Solaris since the main thread is 1 and |
| 84 // subsequent have their ids incremented from there | 86 // subsequent have their ids incremented from there |
| 85 static const pthread_t kNoThread = (pthread_t) 0; | 87 static const pthread_t kNoThread = (pthread_t) 0; |
| 86 | 88 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 109 } | 111 } |
| 110 | 112 |
| 111 | 113 |
| 112 void OS::ReleaseStore(volatile AtomicWord* ptr, AtomicWord value) { | 114 void OS::ReleaseStore(volatile AtomicWord* ptr, AtomicWord value) { |
| 113 __asm__ __volatile__("" : : : "memory"); | 115 __asm__ __volatile__("" : : : "memory"); |
| 114 *ptr = value; | 116 *ptr = value; |
| 115 } | 117 } |
| 116 | 118 |
| 117 | 119 |
| 118 const char* OS::LocalTimezone(double time) { | 120 const char* OS::LocalTimezone(double time) { |
| 119 if (isnan(time)) return ""; | 121 if (std::isnan(time)) return ""; |
| 120 time_t tv = static_cast<time_t>(floor(time/msPerSecond)); | 122 time_t tv = static_cast<time_t>(floor(time/msPerSecond)); |
| 121 struct tm* t = localtime(&tv); | 123 struct tm* t = localtime(&tv); |
| 122 if (NULL == t) return ""; | 124 if (NULL == t) return ""; |
| 123 return tzname[0]; // The location of the timezone string on Solaris. | 125 return tzname[0]; // The location of the timezone string on Solaris. |
| 124 } | 126 } |
| 125 | 127 |
| 126 | 128 |
| 127 double OS::LocalTimeOffset() { | 129 double OS::LocalTimeOffset() { |
| 128 tzset(); | 130 tzset(); |
| 129 return -static_cast<double>(timezone * msPerSecond); | 131 return -static_cast<double>(timezone * msPerSecond); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 limit_mutex = CreateMutex(); | 674 limit_mutex = CreateMutex(); |
| 673 } | 675 } |
| 674 | 676 |
| 675 | 677 |
| 676 void OS::TearDown() { | 678 void OS::TearDown() { |
| 677 delete limit_mutex; | 679 delete limit_mutex; |
| 678 } | 680 } |
| 679 | 681 |
| 680 | 682 |
| 681 } } // namespace v8::internal | 683 } } // namespace v8::internal |
| OLD | NEW |