Index: src/v8.cc |
diff --git a/src/v8.cc b/src/v8.cc |
index 506f3f66068bb2809d06fd4297d231fe602b20eb..98b30385937f47767ffaa53c5f7d9d08b986ab40 100644 |
--- a/src/v8.cc |
+++ b/src/v8.cc |
@@ -36,8 +36,6 @@ |
#include "hydrogen.h" |
#include "lithium-allocator.h" |
#include "log.h" |
-#include "once.h" |
-#include "platform.h" |
#include "runtime-profiler.h" |
#include "serialize.h" |
#include "store-buffer.h" |
@@ -45,7 +43,8 @@ |
namespace v8 { |
namespace internal { |
-V8_DECLARE_ONCE(init_once); |
+static Mutex* init_once_mutex = OS::CreateMutex(); |
+static bool init_once_called = false; |
bool V8::is_running_ = false; |
bool V8::has_been_set_up_ = false; |
@@ -54,8 +53,7 @@ bool V8::has_fatal_error_ = false; |
bool V8::use_crankshaft_ = true; |
List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; |
-static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER; |
- |
+static Mutex* entropy_mutex = OS::CreateMutex(); |
static EntropySource entropy_source; |
@@ -119,7 +117,7 @@ static void seed_random(uint32_t* state) { |
state[i] = FLAG_random_seed; |
} else if (entropy_source != NULL) { |
uint32_t val; |
- ScopedLock lock(entropy_mutex.Pointer()); |
+ ScopedLock lock(entropy_mutex); |
entropy_source(reinterpret_cast<unsigned char*>(&val), sizeof(uint32_t)); |
state[i] = val; |
} else { |
@@ -239,7 +237,12 @@ Object* V8::FillHeapNumberWithRandom(Object* heap_number, |
return heap_number; |
} |
-void V8::InitializeOncePerProcessImpl() { |
+ |
+void V8::InitializeOncePerProcess() { |
+ ScopedLock lock(init_once_mutex); |
+ if (init_once_called) return; |
+ init_once_called = true; |
+ |
// Set up the platform OS support. |
OS::SetUp(); |
@@ -263,12 +266,6 @@ void V8::InitializeOncePerProcessImpl() { |
FLAG_gc_global = true; |
FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; |
} |
- |
- LOperand::SetUpCaches(); |
-} |
- |
-void V8::InitializeOncePerProcess() { |
- CallOnce(&init_once, &InitializeOncePerProcessImpl); |
} |
} } // namespace v8::internal |