| Index: src/platform-posix.cc
|
| diff --git a/src/platform-posix.cc b/src/platform-posix.cc
|
| index 4543a66e8c595c6926ed7081f6fbf02b7258506f..4b1edfe06a8895ae53d46c1ff5c08bd5419f86d8 100644
|
| --- a/src/platform-posix.cc
|
| +++ b/src/platform-posix.cc
|
| @@ -127,27 +127,27 @@ double modulo(double x, double y) {
|
| }
|
|
|
|
|
| -static Mutex* transcendental_function_mutex = OS::CreateMutex();
|
| -
|
| -#define TRANSCENDENTAL_FUNCTION(name, type) \
|
| -static TranscendentalFunction fast_##name##_function = NULL; \
|
| -double fast_##name(double x) { \
|
| - if (fast_##name##_function == NULL) { \
|
| - ScopedLock lock(transcendental_function_mutex); \
|
| - TranscendentalFunction temp = \
|
| - CreateTranscendentalFunction(type); \
|
| - MemoryBarrier(); \
|
| - fast_##name##_function = temp; \
|
| - } \
|
| - return (*fast_##name##_function)(x); \
|
| -}
|
| -
|
| -TRANSCENDENTAL_FUNCTION(sin, TranscendentalCache::SIN)
|
| -TRANSCENDENTAL_FUNCTION(cos, TranscendentalCache::COS)
|
| -TRANSCENDENTAL_FUNCTION(tan, TranscendentalCache::TAN)
|
| -TRANSCENDENTAL_FUNCTION(log, TranscendentalCache::LOG)
|
| -
|
| -#undef TRANSCENDENTAL_FUNCTION
|
| +static Mutex* math_function_mutex = OS::CreateMutex();
|
| +
|
| +#define UNARY_MATH_FUNCTION(name, generator) \
|
| +static UnaryMathFunction fast_##name##_function = NULL; \
|
| +double fast_##name(double x) { \
|
| + if (fast_##name##_function == NULL) { \
|
| + ScopedLock lock(math_function_mutex); \
|
| + UnaryMathFunction temp = generator; \
|
| + MemoryBarrier(); \
|
| + fast_##name##_function = temp; \
|
| + } \
|
| + return (*fast_##name##_function)(x); \
|
| +}
|
| +
|
| +UNARY_MATH_FUNCTION(sin, CreateTranscendentalFunction(TranscendentalCache::SIN))
|
| +UNARY_MATH_FUNCTION(cos, CreateTranscendentalFunction(TranscendentalCache::COS))
|
| +UNARY_MATH_FUNCTION(tan, CreateTranscendentalFunction(TranscendentalCache::TAN))
|
| +UNARY_MATH_FUNCTION(log, CreateTranscendentalFunction(TranscendentalCache::LOG))
|
| +UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction())
|
| +
|
| +#undef MATH_FUNCTION
|
|
|
|
|
| double OS::nan_value() {
|
|
|