Revision: 11014
Author:   [email protected]
Date:     Mon Mar 12 09:10:53 2012
Log: Use lazy instance initializer to remove static initializers in two places.
Review URL: https://chromiumcodereview.appspot.com/9664067
http://code.google.com/p/v8/source/detail?r=11014

Modified:
 /branches/bleeding_edge/src/platform-posix.cc
 /branches/bleeding_edge/src/platform-win32.cc

=======================================
--- /branches/bleeding_edge/src/platform-posix.cc       Mon Mar 12 07:56:04 2012
+++ /branches/bleeding_edge/src/platform-posix.cc       Mon Mar 12 09:10:53 2012
@@ -127,13 +127,13 @@
 }


-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;                       \
=======================================
--- /branches/bleeding_edge/src/platform-win32.cc       Mon Mar 12 07:56:04 2012
+++ /branches/bleeding_edge/src/platform-win32.cc       Mon Mar 12 09:10:53 2012
@@ -208,13 +208,13 @@
 #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;                       \

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to