| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 #endif // __MINGW32__ | 126 #endif // __MINGW32__ |
| 127 | 127 |
| 128 namespace v8 { | 128 namespace v8 { |
| 129 namespace internal { | 129 namespace internal { |
| 130 | 130 |
| 131 intptr_t OS::MaxVirtualMemory() { | 131 intptr_t OS::MaxVirtualMemory() { |
| 132 return 0; | 132 return 0; |
| 133 } | 133 } |
| 134 | 134 |
| 135 | 135 |
| 136 double ceiling(double x) { | |
| 137 return ceil(x); | |
| 138 } | |
| 139 | |
| 140 | |
| 141 #if V8_TARGET_ARCH_IA32 | 136 #if V8_TARGET_ARCH_IA32 |
| 142 static void MemMoveWrapper(void* dest, const void* src, size_t size) { | 137 static void MemMoveWrapper(void* dest, const void* src, size_t size) { |
| 143 memmove(dest, src, size); | 138 memmove(dest, src, size); |
| 144 } | 139 } |
| 145 | 140 |
| 146 | 141 |
| 147 // Initialize to library version so we can call this at any time during startup. | 142 // Initialize to library version so we can call this at any time during startup. |
| 148 static OS::MemMoveFunction memmove_function = &MemMoveWrapper; | 143 static OS::MemMoveFunction memmove_function = &MemMoveWrapper; |
| 149 | 144 |
| 150 // Defined in codegen-ia32.cc. | 145 // Defined in codegen-ia32.cc. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 189 |
| 195 #define UNARY_MATH_FUNCTION(name, generator) \ | 190 #define UNARY_MATH_FUNCTION(name, generator) \ |
| 196 static UnaryMathFunction fast_##name##_function = NULL; \ | 191 static UnaryMathFunction fast_##name##_function = NULL; \ |
| 197 void init_fast_##name##_function() { \ | 192 void init_fast_##name##_function() { \ |
| 198 fast_##name##_function = generator; \ | 193 fast_##name##_function = generator; \ |
| 199 } \ | 194 } \ |
| 200 double fast_##name(double x) { \ | 195 double fast_##name(double x) { \ |
| 201 return (*fast_##name##_function)(x); \ | 196 return (*fast_##name##_function)(x); \ |
| 202 } | 197 } |
| 203 | 198 |
| 204 UNARY_MATH_FUNCTION(sin, CreateTranscendentalFunction(TranscendentalCache::SIN)) | |
| 205 UNARY_MATH_FUNCTION(cos, CreateTranscendentalFunction(TranscendentalCache::COS)) | |
| 206 UNARY_MATH_FUNCTION(tan, CreateTranscendentalFunction(TranscendentalCache::TAN)) | |
| 207 UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG)) | 199 UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG)) |
| 208 UNARY_MATH_FUNCTION(exp, CreateExpFunction()) | 200 UNARY_MATH_FUNCTION(exp, CreateExpFunction()) |
| 209 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) | 201 UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) |
| 210 | 202 |
| 211 #undef UNARY_MATH_FUNCTION | 203 #undef UNARY_MATH_FUNCTION |
| 212 | 204 |
| 213 | 205 |
| 214 void lazily_initialize_fast_exp() { | 206 void lazily_initialize_fast_exp() { |
| 215 if (fast_exp_function == NULL) { | 207 if (fast_exp_function == NULL) { |
| 216 init_fast_exp_function(); | 208 init_fast_exp_function(); |
| 217 } | 209 } |
| 218 } | 210 } |
| 219 | 211 |
| 220 | 212 |
| 221 void MathSetup() { | 213 void MathSetup() { |
| 222 #ifdef _WIN64 | 214 #ifdef _WIN64 |
| 223 init_modulo_function(); | 215 init_modulo_function(); |
| 224 #endif | 216 #endif |
| 225 init_fast_sin_function(); | |
| 226 init_fast_cos_function(); | |
| 227 init_fast_tan_function(); | |
| 228 init_fast_log_function(); | 217 init_fast_log_function(); |
| 229 // fast_exp is initialized lazily. | 218 // fast_exp is initialized lazily. |
| 230 init_fast_sqrt_function(); | 219 init_fast_sqrt_function(); |
| 231 } | 220 } |
| 232 | 221 |
| 233 | 222 |
| 234 // ---------------------------------------------------------------------------- | 223 // ---------------------------------------------------------------------------- |
| 235 // 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 |
| 236 // 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 |
| 237 // 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... |
| 1518 ASSERT(result); | 1507 ASSERT(result); |
| 1519 } | 1508 } |
| 1520 | 1509 |
| 1521 | 1510 |
| 1522 | 1511 |
| 1523 void Thread::YieldCPU() { | 1512 void Thread::YieldCPU() { |
| 1524 Sleep(0); | 1513 Sleep(0); |
| 1525 } | 1514 } |
| 1526 | 1515 |
| 1527 } } // namespace v8::internal | 1516 } } // namespace v8::internal |
| OLD | NEW |