Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: src/platform-posix.cc

Issue 9836108: Rollback of r11015, r11014, r11011, r11010 in trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Finish file upload Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform-openbsd.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-posix.cc
diff --git a/src/platform-posix.cc b/src/platform-posix.cc
index a729b662605ad1377395cf7f0fb9668d3863ce48..4b1edfe06a8895ae53d46c1ff5c08bd5419f86d8 100644
--- a/src/platform-posix.cc
+++ b/src/platform-posix.cc
@@ -127,15 +127,17 @@ double modulo(double x, double y) {
}
+static Mutex* math_function_mutex = OS::CreateMutex();
+
#define UNARY_MATH_FUNCTION(name, generator) \
static UnaryMathFunction fast_##name##_function = NULL; \
-V8_DECLARE_ONCE(fast_##name##_init_once); \
-void init_fast_##name##_function() { \
- fast_##name##_function = generator; \
-} \
double fast_##name(double x) { \
- CallOnce(&fast_##name##_init_once, \
- &init_fast_##name##_function); \
+ if (fast_##name##_function == NULL) { \
+ ScopedLock lock(math_function_mutex); \
+ UnaryMathFunction temp = generator; \
+ MemoryBarrier(); \
+ fast_##name##_function = temp; \
+ } \
return (*fast_##name##_function)(x); \
}
@@ -305,14 +307,14 @@ int OS::VSNPrintF(Vector<char> str,
#if defined(V8_TARGET_ARCH_IA32)
static OS::MemCopyFunction memcopy_function = NULL;
-static LazyMutex memcopy_function_mutex = LAZY_MUTEX_INITIALIZER;
+static Mutex* memcopy_function_mutex = OS::CreateMutex();
// Defined in codegen-ia32.cc.
OS::MemCopyFunction CreateMemCopyFunction();
// Copy memory area to disjoint memory area.
void OS::MemCopy(void* dest, const void* src, size_t size) {
if (memcopy_function == NULL) {
- ScopedLock lock(memcopy_function_mutex.Pointer());
+ ScopedLock lock(memcopy_function_mutex);
if (memcopy_function == NULL) {
OS::MemCopyFunction temp = CreateMemCopyFunction();
MemoryBarrier();
« no previous file with comments | « src/platform-openbsd.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698