diff options
author | Andras Becsi <andras.becsi@digia.com> | 2013-12-11 21:33:03 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@digia.com> | 2013-12-13 12:34:07 +0100 |
commit | f2a33ff9cbc6d19943f1c7fbddd1f23d23975577 (patch) | |
tree | 0586a32aa390ade8557dfd6b4897f43a07449578 /chromium/v8/src/v8.cc | |
parent | 5362912cdb5eea702b68ebe23702468d17c3017a (diff) | |
download | qtwebengine-chromium-f2a33ff9cbc6d19943f1c7fbddd1f23d23975577.tar.gz |
Update Chromium to branch 1650 (31.0.1650.63)
Change-Id: I57d8c832eaec1eb2364e0a8e7352a6dd354db99f
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'chromium/v8/src/v8.cc')
-rw-r--r-- | chromium/v8/src/v8.cc | 106 |
1 files changed, 17 insertions, 89 deletions
diff --git a/chromium/v8/src/v8.cc b/chromium/v8/src/v8.cc index 521d064129a..e894164cd16 100644 --- a/chromium/v8/src/v8.cc +++ b/chromium/v8/src/v8.cc @@ -50,18 +50,9 @@ namespace internal { V8_DECLARE_ONCE(init_once); -bool V8::is_running_ = false; -bool V8::has_been_set_up_ = false; -bool V8::has_been_disposed_ = false; -bool V8::has_fatal_error_ = false; -bool V8::use_crankshaft_ = true; List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; -static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER; - -static EntropySource entropy_source; - bool V8::Initialize(Deserializer* des) { InitializeOncePerProcess(); @@ -80,31 +71,18 @@ bool V8::Initialize(Deserializer* des) { ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() == i::Isolate::Current()); - if (IsDead()) return false; - Isolate* isolate = Isolate::Current(); + if (isolate->IsDead()) return false; if (isolate->IsInitialized()) return true; - is_running_ = true; - has_been_set_up_ = true; - has_fatal_error_ = false; - has_been_disposed_ = false; - return isolate->Init(des); } -void V8::SetFatalError() { - is_running_ = false; - has_fatal_error_ = true; -} - - void V8::TearDown() { Isolate* isolate = Isolate::Current(); ASSERT(isolate->IsDefaultIsolate()); - - if (!has_been_set_up_ || has_been_disposed_) return; + if (!isolate->IsInitialized()) return; // The isolate has to be torn down before clearing the LOperand // caches so that the optimizing compiler thread (if running) @@ -118,49 +96,10 @@ void V8::TearDown() { RegisteredExtension::UnregisterAll(); Isolate::GlobalTearDown(); - is_running_ = false; - has_been_disposed_ = true; - delete call_completed_callbacks_; call_completed_callbacks_ = NULL; Sampler::TearDown(); - OS::TearDown(); -} - - -static void seed_random(uint32_t* state) { - for (int i = 0; i < 2; ++i) { - if (FLAG_random_seed != 0) { - state[i] = FLAG_random_seed; - } else if (entropy_source != NULL) { - uint32_t val; - ScopedLock lock(entropy_mutex.Pointer()); - entropy_source(reinterpret_cast<unsigned char*>(&val), sizeof(uint32_t)); - state[i] = val; - } else { - state[i] = random(); - } - } -} - - -// Random number generator using George Marsaglia's MWC algorithm. -static uint32_t random_base(uint32_t* state) { - // Initialize seed using the system random(). - // No non-zero seed will ever become zero again. - if (state[0] == 0) seed_random(state); - - // Mix the bits. Never replaces state[i] with 0 if it is nonzero. - state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16); - state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16); - - return (state[0] << 14) + (state[1] & 0x3FFFF); -} - - -void V8::SetEntropySource(EntropySource source) { - entropy_source = source; } @@ -174,26 +113,18 @@ void V8::SetReturnAddressLocationResolver( uint32_t V8::Random(Context* context) { ASSERT(context->IsNativeContext()); ByteArray* seed = context->random_seed(); - return random_base(reinterpret_cast<uint32_t*>(seed->GetDataStartAddress())); -} - - -// Used internally by the JIT and memory allocator for security -// purposes. So, we keep a different state to prevent informations -// leaks that could be used in an exploit. -uint32_t V8::RandomPrivate(Isolate* isolate) { - ASSERT(isolate == Isolate::Current()); - return random_base(isolate->private_random_seed()); -} + uint32_t* state = reinterpret_cast<uint32_t*>(seed->GetDataStartAddress()); + // When we get here, the RNG must have been initialized, + // see the Genesis constructor in file bootstrapper.cc. + ASSERT_NE(0, state[0]); + ASSERT_NE(0, state[1]); -bool V8::IdleNotification(int hint) { - // Returning true tells the caller that there is no need to call - // IdleNotification again. - if (!FLAG_use_idle_notification) return true; + // Mix the bits. Never replaces state[i] with 0 if it is nonzero. + state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16); + state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16); - // Tell the heap that it may want to adjust. - return HEAP->IdleNotification(hint); + return (state[0] << 14) + (state[1] & 0x3FFFF); } @@ -272,9 +203,10 @@ void V8::InitializeOncePerProcessImpl() { FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; } - if (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs) { - // Tracing hydrogen do not work with parallel recompilation. - FLAG_parallel_recompilation = false; + if (FLAG_concurrent_recompilation && + (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs)) { + FLAG_concurrent_recompilation = false; + PrintF("Concurrent recompilation has been disabled for tracing.\n"); } if (FLAG_sweeper_threads <= 0) { @@ -308,18 +240,14 @@ void V8::InitializeOncePerProcessImpl() { FLAG_marking_threads = 0; } - if (FLAG_parallel_recompilation && + if (FLAG_concurrent_recompilation && SystemThreadManager::NumberOfParallelSystemThreads( SystemThreadManager::PARALLEL_RECOMPILATION) == 0) { - FLAG_parallel_recompilation = false; + FLAG_concurrent_recompilation = false; } - OS::SetUp(); Sampler::SetUp(); CPU::SetUp(); - use_crankshaft_ = FLAG_crankshaft - && !Serializer::enabled() - && CPU::SupportsCrankshaft(); OS::PostSetUp(); ElementsAccessor::InitializeOncePerProcess(); LOperand::SetUpCaches(); |