Use lazy instance initializer to remove static initializers in two places.
Review URL: https://chromiumcodereview.appspot.com/9664067 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11014 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
758638a53f
commit
56e9118f56
@ -127,13 +127,13 @@ double modulo(double x, double y) {
|
||||
}
|
||||
|
||||
|
||||
static Mutex* math_function_mutex = OS::CreateMutex();
|
||||
static LazyMutex math_function_mutex = LAZY_MUTEX_INITIALIZER;
|
||||
|
||||
#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); \
|
||||
ScopedLock lock(math_function_mutex.Pointer()); \
|
||||
UnaryMathFunction temp = generator; \
|
||||
MemoryBarrier(); \
|
||||
fast_##name##_function = temp; \
|
||||
|
@ -208,13 +208,13 @@ double modulo(double x, double y) {
|
||||
#endif // _WIN64
|
||||
|
||||
|
||||
static Mutex* math_function_mutex = OS::CreateMutex();
|
||||
static LazyMutex math_function_mutex = LAZY_MUTEX_INITIALIZER;
|
||||
|
||||
#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); \
|
||||
ScopedLock lock(math_function_mutex.Pointer()); \
|
||||
UnaryMathFunction temp = generator; \
|
||||
MemoryBarrier(); \
|
||||
fast_##name##_function = temp; \
|
||||
|
Loading…
Reference in New Issue
Block a user