| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 #define UNARY_MATH_FUNCTION(name, generator) \ | 190 #define UNARY_MATH_FUNCTION(name, generator) \ |
| 191 static UnaryMathFunction fast_##name##_function = NULL; \ | 191 static UnaryMathFunction fast_##name##_function = NULL; \ |
| 192 void init_fast_##name##_function() { \ | 192 void init_fast_##name##_function() { \ |
| 193 fast_##name##_function = generator; \ | 193 fast_##name##_function = generator; \ |
| 194 } \ | 194 } \ |
| 195 double fast_##name(double x) { \ | 195 double fast_##name(double x) { \ |
| 196 return (*fast_##name##_function)(x); \ | 196 return (*fast_##name##_function)(x); \ |
| 197 } | 197 } |
| 198 | 198 |
| 199 UNARY_MATH_FUNCTION(sin, CreateTranscendentalFunction(TranscendentalCache::SIN)) | |
| 200 UNARY_MATH_FUNCTION(cos, CreateTranscendentalFunction(TranscendentalCache::COS)) | |
| 201 UNARY_MATH_FUNCTION(tan, CreateTranscendentalFunction(TranscendentalCache::TAN)) | |
| 202 UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG)) | 199 UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG)) |
| 203 UNARY_MATH_FUNCTION(exp, CreateExpFunction()) | 200 UNARY_MATH_FUNCTION(exp, CreateExpFunction()) |
| 204 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) | 201 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) |
| 205 | 202 |
| 206 #undef UNARY_MATH_FUNCTION | 203 #undef UNARY_MATH_FUNCTION |
| 207 | 204 |
| 208 | 205 |
| 209 void lazily_initialize_fast_exp() { | 206 void lazily_initialize_fast_exp() { |
| 210 if (fast_exp_function == NULL) { | 207 if (fast_exp_function == NULL) { |
| 211 init_fast_exp_function(); | 208 init_fast_exp_function(); |
| 212 } | 209 } |
| 213 } | 210 } |
| 214 | 211 |
| 215 | 212 |
| 216 void MathSetup() { | 213 void MathSetup() { |
| 217 #ifdef _WIN64 | 214 #ifdef _WIN64 |
| 218 init_modulo_function(); | 215 init_modulo_function(); |
| 219 #endif | 216 #endif |
| 220 init_fast_sin_function(); | |
| 221 init_fast_cos_function(); | |
| 222 init_fast_tan_function(); | |
| 223 init_fast_log_function(); | 217 init_fast_log_function(); |
| 224 // fast_exp is initialized lazily. | 218 // fast_exp is initialized lazily. |
| 225 init_fast_sqrt_function(); | 219 init_fast_sqrt_function(); |
| 226 } | 220 } |
| 227 | 221 |
| 228 | 222 |
| 229 // ---------------------------------------------------------------------------- | 223 // ---------------------------------------------------------------------------- |
| 230 // The Time class represents time on win32. A timestamp is represented as | 224 // The Time class represents time on win32. A timestamp is represented as |
| 231 // a 64-bit integer in 100 nanoseconds since January 1, 1601 (UTC). JavaScript | 225 // a 64-bit integer in 100 nanoseconds since January 1, 1601 (UTC). JavaScript |
| 232 // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC, | 226 // timestamps are represented as a doubles in milliseconds since 00:00:00 UTC, |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 ASSERT(result); | 1507 ASSERT(result); |
| 1514 } | 1508 } |
| 1515 | 1509 |
| 1516 | 1510 |
| 1517 | 1511 |
| 1518 void Thread::YieldCPU() { | 1512 void Thread::YieldCPU() { |
| 1519 Sleep(0); | 1513 Sleep(0); |
| 1520 } | 1514 } |
| 1521 | 1515 |
| 1522 } } // namespace v8::internal | 1516 } } // namespace v8::internal |
| OLD | NEW |