| OLD | NEW |
| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 bool V8::has_fatal_error_ = false; | 56 bool V8::has_fatal_error_ = false; |
| 57 bool V8::use_crankshaft_ = true; | 57 bool V8::use_crankshaft_ = true; |
| 58 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; | 58 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; |
| 59 | 59 |
| 60 static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER; | 60 static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER; |
| 61 | 61 |
| 62 static EntropySource entropy_source; | 62 static EntropySource entropy_source; |
| 63 | 63 |
| 64 | 64 |
| 65 bool V8::Initialize(Deserializer* des) { | 65 bool V8::Initialize(Deserializer* des) { |
| 66 FlagList::EnforceFlagImplications(); | |
| 67 | |
| 68 InitializeOncePerProcess(); | 66 InitializeOncePerProcess(); |
| 69 | 67 |
| 70 // The current thread may not yet had entered an isolate to run. | 68 // The current thread may not yet had entered an isolate to run. |
| 71 // Note the Isolate::Current() may be non-null because for various | 69 // Note the Isolate::Current() may be non-null because for various |
| 72 // initialization purposes an initializing thread may be assigned an isolate | 70 // initialization purposes an initializing thread may be assigned an isolate |
| 73 // but not actually enter it. | 71 // but not actually enter it. |
| 74 if (i::Isolate::CurrentPerIsolateThreadData() == NULL) { | 72 if (i::Isolate::CurrentPerIsolateThreadData() == NULL) { |
| 75 i::Isolate::EnterDefaultIsolate(); | 73 i::Isolate::EnterDefaultIsolate(); |
| 76 } | 74 } |
| 77 | 75 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 static const double binary_million = 1048576.0; | 254 static const double binary_million = 1048576.0; |
| 257 r.double_value = binary_million; | 255 r.double_value = binary_million; |
| 258 r.uint64_t_value |= random_bits; | 256 r.uint64_t_value |= random_bits; |
| 259 r.double_value -= binary_million; | 257 r.double_value -= binary_million; |
| 260 | 258 |
| 261 HeapNumber::cast(heap_number)->set_value(r.double_value); | 259 HeapNumber::cast(heap_number)->set_value(r.double_value); |
| 262 return heap_number; | 260 return heap_number; |
| 263 } | 261 } |
| 264 | 262 |
| 265 void V8::InitializeOncePerProcessImpl() { | 263 void V8::InitializeOncePerProcessImpl() { |
| 266 OS::SetUp(); | 264 FlagList::EnforceFlagImplications(); |
| 267 | |
| 268 use_crankshaft_ = FLAG_crankshaft; | |
| 269 | |
| 270 if (Serializer::enabled()) { | |
| 271 use_crankshaft_ = false; | |
| 272 } | |
| 273 | |
| 274 CPU::SetUp(); | |
| 275 if (!CPU::SupportsCrankshaft()) { | |
| 276 use_crankshaft_ = false; | |
| 277 } | |
| 278 | |
| 279 OS::PostSetUp(); | |
| 280 | |
| 281 RuntimeProfiler::GlobalSetUp(); | |
| 282 | |
| 283 ElementsAccessor::InitializeOncePerProcess(); | |
| 284 | |
| 285 if (FLAG_stress_compaction) { | 265 if (FLAG_stress_compaction) { |
| 286 FLAG_force_marking_deque_overflows = true; | 266 FLAG_force_marking_deque_overflows = true; |
| 287 FLAG_gc_global = true; | 267 FLAG_gc_global = true; |
| 288 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; | 268 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; |
| 289 } | 269 } |
| 290 | 270 OS::SetUp(); |
| 271 CPU::SetUp(); |
| 272 use_crankshaft_ = FLAG_crankshaft |
| 273 && !Serializer::enabled() |
| 274 && CPU::SupportsCrankshaft(); |
| 275 OS::PostSetUp(); |
| 276 RuntimeProfiler::GlobalSetUp(); |
| 277 ElementsAccessor::InitializeOncePerProcess(); |
| 291 LOperand::SetUpCaches(); | 278 LOperand::SetUpCaches(); |
| 292 SetUpJSCallerSavedCodeData(); | 279 SetUpJSCallerSavedCodeData(); |
| 293 SamplerRegistry::SetUp(); | 280 SamplerRegistry::SetUp(); |
| 294 ExternalReference::SetUp(); | 281 ExternalReference::SetUp(); |
| 295 } | 282 } |
| 296 | 283 |
| 297 void V8::InitializeOncePerProcess() { | 284 void V8::InitializeOncePerProcess() { |
| 298 CallOnce(&init_once, &InitializeOncePerProcessImpl); | 285 CallOnce(&init_once, &InitializeOncePerProcessImpl); |
| 299 } | 286 } |
| 300 | 287 |
| 301 } } // namespace v8::internal | 288 } } // namespace v8::internal |
| OLD | NEW |