| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 29 matching lines...) Expand all Loading... |
| 40 #include "serialize.h" | 40 #include "serialize.h" |
| 41 #include "store-buffer.h" | 41 #include "store-buffer.h" |
| 42 | 42 |
| 43 namespace v8 { | 43 namespace v8 { |
| 44 namespace internal { | 44 namespace internal { |
| 45 | 45 |
| 46 static Mutex* init_once_mutex = OS::CreateMutex(); | 46 static Mutex* init_once_mutex = OS::CreateMutex(); |
| 47 static bool init_once_called = false; | 47 static bool init_once_called = false; |
| 48 | 48 |
| 49 bool V8::is_running_ = false; | 49 bool V8::is_running_ = false; |
| 50 bool V8::has_been_setup_ = false; | 50 bool V8::has_been_set_up_ = false; |
| 51 bool V8::has_been_disposed_ = false; | 51 bool V8::has_been_disposed_ = false; |
| 52 bool V8::has_fatal_error_ = false; | 52 bool V8::has_fatal_error_ = false; |
| 53 bool V8::use_crankshaft_ = true; | 53 bool V8::use_crankshaft_ = true; |
| 54 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; | 54 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; |
| 55 | 55 |
| 56 static Mutex* entropy_mutex = OS::CreateMutex(); | 56 static Mutex* entropy_mutex = OS::CreateMutex(); |
| 57 static EntropySource entropy_source; | 57 static EntropySource entropy_source; |
| 58 | 58 |
| 59 | 59 |
| 60 bool V8::Initialize(Deserializer* des) { | 60 bool V8::Initialize(Deserializer* des) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 75 i::ThreadId::Current())); | 75 i::ThreadId::Current())); |
| 76 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() == | 76 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() == |
| 77 i::Isolate::Current()); | 77 i::Isolate::Current()); |
| 78 | 78 |
| 79 if (IsDead()) return false; | 79 if (IsDead()) return false; |
| 80 | 80 |
| 81 Isolate* isolate = Isolate::Current(); | 81 Isolate* isolate = Isolate::Current(); |
| 82 if (isolate->IsInitialized()) return true; | 82 if (isolate->IsInitialized()) return true; |
| 83 | 83 |
| 84 is_running_ = true; | 84 is_running_ = true; |
| 85 has_been_setup_ = true; | 85 has_been_set_up_ = true; |
| 86 has_fatal_error_ = false; | 86 has_fatal_error_ = false; |
| 87 has_been_disposed_ = false; | 87 has_been_disposed_ = false; |
| 88 | 88 |
| 89 return isolate->Init(des); | 89 return isolate->Init(des); |
| 90 } | 90 } |
| 91 | 91 |
| 92 | 92 |
| 93 void V8::SetFatalError() { | 93 void V8::SetFatalError() { |
| 94 is_running_ = false; | 94 is_running_ = false; |
| 95 has_fatal_error_ = true; | 95 has_fatal_error_ = true; |
| 96 } | 96 } |
| 97 | 97 |
| 98 | 98 |
| 99 void V8::TearDown() { | 99 void V8::TearDown() { |
| 100 Isolate* isolate = Isolate::Current(); | 100 Isolate* isolate = Isolate::Current(); |
| 101 ASSERT(isolate->IsDefaultIsolate()); | 101 ASSERT(isolate->IsDefaultIsolate()); |
| 102 | 102 |
| 103 if (!has_been_setup_ || has_been_disposed_) return; | 103 if (!has_been_set_up_ || has_been_disposed_) return; |
| 104 isolate->TearDown(); | 104 isolate->TearDown(); |
| 105 | 105 |
| 106 is_running_ = false; | 106 is_running_ = false; |
| 107 has_been_disposed_ = true; | 107 has_been_disposed_ = true; |
| 108 | 108 |
| 109 delete call_completed_callbacks_; | 109 delete call_completed_callbacks_; |
| 110 call_completed_callbacks_ = NULL; | 110 call_completed_callbacks_ = NULL; |
| 111 } | 111 } |
| 112 | 112 |
| 113 | 113 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 return heap_number; | 233 return heap_number; |
| 234 } | 234 } |
| 235 | 235 |
| 236 | 236 |
| 237 void V8::InitializeOncePerProcess() { | 237 void V8::InitializeOncePerProcess() { |
| 238 ScopedLock lock(init_once_mutex); | 238 ScopedLock lock(init_once_mutex); |
| 239 if (init_once_called) return; | 239 if (init_once_called) return; |
| 240 init_once_called = true; | 240 init_once_called = true; |
| 241 | 241 |
| 242 // Setup the platform OS support. | 242 // Set up the platform OS support. |
| 243 OS::Setup(); | 243 OS::SetUp(); |
| 244 | 244 |
| 245 use_crankshaft_ = FLAG_crankshaft; | 245 use_crankshaft_ = FLAG_crankshaft; |
| 246 | 246 |
| 247 if (Serializer::enabled()) { | 247 if (Serializer::enabled()) { |
| 248 use_crankshaft_ = false; | 248 use_crankshaft_ = false; |
| 249 } | 249 } |
| 250 | 250 |
| 251 CPU::Setup(); | 251 CPU::SetUp(); |
| 252 if (!CPU::SupportsCrankshaft()) { | 252 if (!CPU::SupportsCrankshaft()) { |
| 253 use_crankshaft_ = false; | 253 use_crankshaft_ = false; |
| 254 } | 254 } |
| 255 | 255 |
| 256 RuntimeProfiler::GlobalSetup(); | 256 RuntimeProfiler::GlobalSetup(); |
| 257 | 257 |
| 258 // Peephole optimization might interfere with deoptimization. | 258 // Peephole optimization might interfere with deoptimization. |
| 259 FLAG_peephole_optimization = !use_crankshaft_; | 259 FLAG_peephole_optimization = !use_crankshaft_; |
| 260 | 260 |
| 261 ElementsAccessor::InitializeOncePerProcess(); | 261 ElementsAccessor::InitializeOncePerProcess(); |
| 262 | 262 |
| 263 if (FLAG_stress_compaction) { | 263 if (FLAG_stress_compaction) { |
| 264 FLAG_force_marking_deque_overflows = true; | 264 FLAG_force_marking_deque_overflows = true; |
| 265 FLAG_gc_global = true; | 265 FLAG_gc_global = true; |
| 266 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; | 266 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 } } // namespace v8::internal | 270 } } // namespace v8::internal |
| OLD | NEW |