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

Side by Side Diff: src/v8.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, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/v8.h ('k') | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 18 matching lines...) Expand all
29 29
30 #include "isolate.h" 30 #include "isolate.h"
31 #include "elements.h" 31 #include "elements.h"
32 #include "bootstrapper.h" 32 #include "bootstrapper.h"
33 #include "debug.h" 33 #include "debug.h"
34 #include "deoptimizer.h" 34 #include "deoptimizer.h"
35 #include "heap-profiler.h" 35 #include "heap-profiler.h"
36 #include "hydrogen.h" 36 #include "hydrogen.h"
37 #include "lithium-allocator.h" 37 #include "lithium-allocator.h"
38 #include "log.h" 38 #include "log.h"
39 #include "once.h"
40 #include "platform.h"
41 #include "runtime-profiler.h" 39 #include "runtime-profiler.h"
42 #include "serialize.h" 40 #include "serialize.h"
43 #include "store-buffer.h" 41 #include "store-buffer.h"
44 42
45 namespace v8 { 43 namespace v8 {
46 namespace internal { 44 namespace internal {
47 45
48 V8_DECLARE_ONCE(init_once); 46 static Mutex* init_once_mutex = OS::CreateMutex();
47 static bool init_once_called = false;
49 48
50 bool V8::is_running_ = false; 49 bool V8::is_running_ = false;
51 bool V8::has_been_set_up_ = false; 50 bool V8::has_been_set_up_ = false;
52 bool V8::has_been_disposed_ = false; 51 bool V8::has_been_disposed_ = false;
53 bool V8::has_fatal_error_ = false; 52 bool V8::has_fatal_error_ = false;
54 bool V8::use_crankshaft_ = true; 53 bool V8::use_crankshaft_ = true;
55 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; 54 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL;
56 55
57 static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER; 56 static Mutex* entropy_mutex = OS::CreateMutex();
58
59 static EntropySource entropy_source; 57 static EntropySource entropy_source;
60 58
61 59
62 bool V8::Initialize(Deserializer* des) { 60 bool V8::Initialize(Deserializer* des) {
63 FlagList::EnforceFlagImplications(); 61 FlagList::EnforceFlagImplications();
64 62
65 InitializeOncePerProcess(); 63 InitializeOncePerProcess();
66 64
67 // The current thread may not yet had entered an isolate to run. 65 // The current thread may not yet had entered an isolate to run.
68 // Note the Isolate::Current() may be non-null because for various 66 // Note the Isolate::Current() may be non-null because for various
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 call_completed_callbacks_ = NULL; 110 call_completed_callbacks_ = NULL;
113 } 111 }
114 112
115 113
116 static void seed_random(uint32_t* state) { 114 static void seed_random(uint32_t* state) {
117 for (int i = 0; i < 2; ++i) { 115 for (int i = 0; i < 2; ++i) {
118 if (FLAG_random_seed != 0) { 116 if (FLAG_random_seed != 0) {
119 state[i] = FLAG_random_seed; 117 state[i] = FLAG_random_seed;
120 } else if (entropy_source != NULL) { 118 } else if (entropy_source != NULL) {
121 uint32_t val; 119 uint32_t val;
122 ScopedLock lock(entropy_mutex.Pointer()); 120 ScopedLock lock(entropy_mutex);
123 entropy_source(reinterpret_cast<unsigned char*>(&val), sizeof(uint32_t)); 121 entropy_source(reinterpret_cast<unsigned char*>(&val), sizeof(uint32_t));
124 state[i] = val; 122 state[i] = val;
125 } else { 123 } else {
126 state[i] = random(); 124 state[i] = random();
127 } 125 }
128 } 126 }
129 } 127 }
130 128
131 129
132 // Random number generator using George Marsaglia's MWC algorithm. 130 // Random number generator using George Marsaglia's MWC algorithm.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). 230 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
233 static const double binary_million = 1048576.0; 231 static const double binary_million = 1048576.0;
234 r.double_value = binary_million; 232 r.double_value = binary_million;
235 r.uint64_t_value |= random_bits; 233 r.uint64_t_value |= random_bits;
236 r.double_value -= binary_million; 234 r.double_value -= binary_million;
237 235
238 HeapNumber::cast(heap_number)->set_value(r.double_value); 236 HeapNumber::cast(heap_number)->set_value(r.double_value);
239 return heap_number; 237 return heap_number;
240 } 238 }
241 239
242 void V8::InitializeOncePerProcessImpl() { 240
241 void V8::InitializeOncePerProcess() {
242 ScopedLock lock(init_once_mutex);
243 if (init_once_called) return;
244 init_once_called = true;
245
243 // Set up the platform OS support. 246 // Set up the platform OS support.
244 OS::SetUp(); 247 OS::SetUp();
245 248
246 use_crankshaft_ = FLAG_crankshaft; 249 use_crankshaft_ = FLAG_crankshaft;
247 250
248 if (Serializer::enabled()) { 251 if (Serializer::enabled()) {
249 use_crankshaft_ = false; 252 use_crankshaft_ = false;
250 } 253 }
251 254
252 CPU::SetUp(); 255 CPU::SetUp();
253 if (!CPU::SupportsCrankshaft()) { 256 if (!CPU::SupportsCrankshaft()) {
254 use_crankshaft_ = false; 257 use_crankshaft_ = false;
255 } 258 }
256 259
257 RuntimeProfiler::GlobalSetup(); 260 RuntimeProfiler::GlobalSetup();
258 261
259 ElementsAccessor::InitializeOncePerProcess(); 262 ElementsAccessor::InitializeOncePerProcess();
260 263
261 if (FLAG_stress_compaction) { 264 if (FLAG_stress_compaction) {
262 FLAG_force_marking_deque_overflows = true; 265 FLAG_force_marking_deque_overflows = true;
263 FLAG_gc_global = true; 266 FLAG_gc_global = true;
264 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; 267 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2;
265 } 268 }
266
267 LOperand::SetUpCaches();
268 }
269
270 void V8::InitializeOncePerProcess() {
271 CallOnce(&init_once, &InitializeOncePerProcessImpl);
272 } 269 }
273 270
274 } } // namespace v8::internal 271 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/v8.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698