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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 #else | 289 #else |
290 #error Unsupported host architecture. | 290 #error Unsupported host architecture. |
291 #endif | 291 #endif |
292 } | 292 } |
293 | 293 |
294 | 294 |
295 // ---------------------------------------------------------------------------- | 295 // ---------------------------------------------------------------------------- |
296 // Math functions | 296 // Math functions |
297 | 297 |
298 double modulo(double x, double y) { | 298 double modulo(double x, double y) { |
299 return fmod(x, y); | 299 return std::fmod(x, y); |
300 } | 300 } |
301 | 301 |
302 | 302 |
303 #define UNARY_MATH_FUNCTION(name, generator) \ | 303 #define UNARY_MATH_FUNCTION(name, generator) \ |
304 static UnaryMathFunction fast_##name##_function = NULL; \ | 304 static UnaryMathFunction fast_##name##_function = NULL; \ |
305 void init_fast_##name##_function() { \ | 305 void init_fast_##name##_function() { \ |
306 fast_##name##_function = generator; \ | 306 fast_##name##_function = generator; \ |
307 } \ | 307 } \ |
308 double fast_##name(double x) { \ | 308 double fast_##name(double x) { \ |
309 return (*fast_##name##_function)(x); \ | 309 return (*fast_##name##_function)(x); \ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } | 347 } |
348 | 348 |
349 | 349 |
350 double OS::TimeCurrentMillis() { | 350 double OS::TimeCurrentMillis() { |
351 return Time::Now().ToJsTime(); | 351 return Time::Now().ToJsTime(); |
352 } | 352 } |
353 | 353 |
354 | 354 |
355 double OS::DaylightSavingsOffset(double time) { | 355 double OS::DaylightSavingsOffset(double time) { |
356 if (std::isnan(time)) return nan_value(); | 356 if (std::isnan(time)) return nan_value(); |
357 time_t tv = static_cast<time_t>(floor(time/msPerSecond)); | 357 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
358 struct tm* t = localtime(&tv); | 358 struct tm* t = localtime(&tv); |
359 if (NULL == t) return nan_value(); | 359 if (NULL == t) return nan_value(); |
360 return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; | 360 return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; |
361 } | 361 } |
362 | 362 |
363 | 363 |
364 int OS::GetLastError() { | 364 int OS::GetLastError() { |
365 return errno; | 365 return errno; |
366 } | 366 } |
367 | 367 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 | 776 |
777 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 777 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
778 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 778 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
779 int result = pthread_setspecific(pthread_key, value); | 779 int result = pthread_setspecific(pthread_key, value); |
780 ASSERT_EQ(0, result); | 780 ASSERT_EQ(0, result); |
781 USE(result); | 781 USE(result); |
782 } | 782 } |
783 | 783 |
784 | 784 |
785 } } // namespace v8::internal | 785 } } // namespace v8::internal |
OLD | NEW |