| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) && | 201 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) && |
| 202 !(x == 0 && (y != 0 && isfinite(y)))) { | 202 !(x == 0 && (y != 0 && isfinite(y)))) { |
| 203 x = fmod(x, y); | 203 x = fmod(x, y); |
| 204 } | 204 } |
| 205 return x; | 205 return x; |
| 206 } | 206 } |
| 207 | 207 |
| 208 #endif // _WIN64 | 208 #endif // _WIN64 |
| 209 | 209 |
| 210 | 210 |
| 211 static Mutex* transcendental_function_mutex = OS::CreateMutex(); | 211 static Mutex* math_function_mutex = OS::CreateMutex(); |
| 212 | 212 |
| 213 #define TRANSCENDENTAL_FUNCTION(name, type) \ | 213 #define UNARY_MATH_FUNCTION(name, generator) \ |
| 214 static TranscendentalFunction fast_##name##_function = NULL; \ | 214 static UnaryMathFunction fast_##name##_function = NULL; \ |
| 215 double fast_##name(double x) { \ | 215 double fast_##name(double x) { \ |
| 216 if (fast_##name##_function == NULL) { \ | 216 if (fast_##name##_function == NULL) { \ |
| 217 ScopedLock lock(transcendental_function_mutex); \ | 217 ScopedLock lock(math_function_mutex); \ |
| 218 TranscendentalFunction temp = \ | 218 UnaryMathFunction temp = generator; \ |
| 219 CreateTranscendentalFunction(type); \ | 219 MemoryBarrier(); \ |
| 220 MemoryBarrier(); \ | 220 fast_##name##_function = temp; \ |
| 221 fast_##name##_function = temp; \ | 221 } \ |
| 222 } \ | 222 return (*fast_##name##_function)(x); \ |
| 223 return (*fast_##name##_function)(x); \ | |
| 224 } | 223 } |
| 225 | 224 |
| 226 TRANSCENDENTAL_FUNCTION(sin, TranscendentalCache::SIN) | 225 UNARY_MATH_FUNCTION(sin, CreateTranscendentalFunction(TranscendentalCache::SIN)) |
| 227 TRANSCENDENTAL_FUNCTION(cos, TranscendentalCache::COS) | 226 UNARY_MATH_FUNCTION(cos, CreateTranscendentalFunction(TranscendentalCache::COS)) |
| 228 TRANSCENDENTAL_FUNCTION(tan, TranscendentalCache::TAN) | 227 UNARY_MATH_FUNCTION(tan, CreateTranscendentalFunction(TranscendentalCache::TAN)) |
| 229 TRANSCENDENTAL_FUNCTION(log, TranscendentalCache::LOG) | 228 UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG)) |
| 229 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) |
| 230 | 230 |
| 231 #undef TRANSCENDENTAL_FUNCTION | 231 #undef MATH_FUNCTION |
| 232 | 232 |
| 233 | 233 |
| 234 // ---------------------------------------------------------------------------- | 234 // ---------------------------------------------------------------------------- |
| 235 // The Time class represents time on win32. A timestamp is represented as | 235 // The Time class represents time on win32. A timestamp is represented as |
| 236 // a 64-bit integer in 100 nanoseconds since January 1, 1601 (UTC). JavaScript | 236 // a 64-bit integer in 100 nanoseconds since January 1, 1601 (UTC). JavaScript |
| 237 // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC, | 237 // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC, |
| 238 // January 1, 1970. | 238 // January 1, 1970. |
| 239 | 239 |
| 240 class Time { | 240 class Time { |
| 241 public: | 241 public: |
| (...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 | 2094 |
| 2095 | 2095 |
| 2096 void Sampler::Stop() { | 2096 void Sampler::Stop() { |
| 2097 ASSERT(IsActive()); | 2097 ASSERT(IsActive()); |
| 2098 SamplerThread::RemoveActiveSampler(this); | 2098 SamplerThread::RemoveActiveSampler(this); |
| 2099 SetActive(false); | 2099 SetActive(false); |
| 2100 } | 2100 } |
| 2101 | 2101 |
| 2102 | 2102 |
| 2103 } } // namespace v8::internal | 2103 } } // namespace v8::internal |
| OLD | NEW |