Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "assembler.h" | 30 #include "assembler.h" |
| 31 #include "isolate.h" | 31 #include "isolate.h" |
| 32 #include "elements.h" | 32 #include "elements.h" |
| 33 #include "bootstrapper.h" | 33 #include "bootstrapper.h" |
| 34 #include "crankshaft-thread.h" | |
| 34 #include "debug.h" | 35 #include "debug.h" |
| 35 #include "deoptimizer.h" | 36 #include "deoptimizer.h" |
| 36 #include "frames.h" | 37 #include "frames.h" |
| 37 #include "heap-profiler.h" | 38 #include "heap-profiler.h" |
| 38 #include "hydrogen.h" | 39 #include "hydrogen.h" |
| 39 #include "lithium-allocator.h" | 40 #include "lithium-allocator.h" |
| 40 #include "log.h" | 41 #include "log.h" |
| 41 #include "once.h" | 42 #include "once.h" |
| 42 #include "platform.h" | 43 #include "platform.h" |
| 43 #include "runtime-profiler.h" | 44 #include "runtime-profiler.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 has_fatal_error_ = true; | 100 has_fatal_error_ = true; |
| 100 } | 101 } |
| 101 | 102 |
| 102 | 103 |
| 103 void V8::TearDown() { | 104 void V8::TearDown() { |
| 104 Isolate* isolate = Isolate::Current(); | 105 Isolate* isolate = Isolate::Current(); |
| 105 ASSERT(isolate->IsDefaultIsolate()); | 106 ASSERT(isolate->IsDefaultIsolate()); |
| 106 | 107 |
| 107 if (!has_been_set_up_ || has_been_disposed_) return; | 108 if (!has_been_set_up_ || has_been_disposed_) return; |
| 108 | 109 |
| 109 ElementsAccessor::TearDown(); | 110 if (FLAG_concurrent_crankshaft) { |
| 110 LOperand::TearDownCaches(); | 111 // Lock only when required. |
| 111 RegisteredExtension::UnregisterAll(); | 112 bool to_lock = !isolate->thread_manager()->IsLockedByCurrentThread(); |
| 112 | 113 if (to_lock) |
| 113 isolate->TearDown(); | 114 isolate->thread_manager()->Lock(); |
| 114 delete isolate; | 115 isolate->TearDown(); |
| 116 // The crankshaft thread will tear down ElementsAccessor, LOperand | |
| 117 // and RegisteredExtension once it is safe to do so. | |
| 118 if (to_lock) | |
| 119 isolate->thread_manager()->Unlock(); | |
| 120 CrankshaftThread::StopThread(); | |
| 121 } else { | |
| 122 ElementsAccessor::TearDown(); | |
|
danno
2012/05/22 10:32:19
Yikes, this tear down work should always happen he
| |
| 123 LOperand::TearDownCaches(); | |
| 124 RegisteredExtension::UnregisterAll(); | |
| 125 isolate->TearDown(); | |
| 126 delete isolate; | |
| 127 } | |
| 115 | 128 |
| 116 is_running_ = false; | 129 is_running_ = false; |
| 117 has_been_disposed_ = true; | 130 has_been_disposed_ = true; |
| 118 | 131 |
| 119 delete call_completed_callbacks_; | 132 delete call_completed_callbacks_; |
| 120 call_completed_callbacks_ = NULL; | 133 call_completed_callbacks_ = NULL; |
| 121 | 134 |
| 122 OS::TearDown(); | 135 OS::TearDown(); |
| 123 } | 136 } |
| 124 | 137 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 r.uint64_t_value |= random_bits; | 258 r.uint64_t_value |= random_bits; |
| 246 r.double_value -= binary_million; | 259 r.double_value -= binary_million; |
| 247 | 260 |
| 248 HeapNumber::cast(heap_number)->set_value(r.double_value); | 261 HeapNumber::cast(heap_number)->set_value(r.double_value); |
| 249 return heap_number; | 262 return heap_number; |
| 250 } | 263 } |
| 251 | 264 |
| 252 void V8::InitializeOncePerProcessImpl() { | 265 void V8::InitializeOncePerProcessImpl() { |
| 253 OS::SetUp(); | 266 OS::SetUp(); |
| 254 | 267 |
| 268 if (i::FLAG_concurrent_crankshaft) | |
|
danno
2012/05/22 10:32:19
nit: Always use { } even around single line statem
| |
| 269 i::CrankshaftThread::StartThread(); | |
| 270 | |
| 255 use_crankshaft_ = FLAG_crankshaft; | 271 use_crankshaft_ = FLAG_crankshaft; |
| 256 | 272 |
| 257 if (Serializer::enabled()) { | 273 if (Serializer::enabled()) { |
| 258 use_crankshaft_ = false; | 274 use_crankshaft_ = false; |
| 259 } | 275 } |
| 260 | 276 |
| 261 CPU::SetUp(); | 277 CPU::SetUp(); |
| 262 if (!CPU::SupportsCrankshaft()) { | 278 if (!CPU::SupportsCrankshaft()) { |
| 263 use_crankshaft_ = false; | 279 use_crankshaft_ = false; |
| 264 } | 280 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 279 SetUpJSCallerSavedCodeData(); | 295 SetUpJSCallerSavedCodeData(); |
| 280 SamplerRegistry::SetUp(); | 296 SamplerRegistry::SetUp(); |
| 281 ExternalReference::SetUp(); | 297 ExternalReference::SetUp(); |
| 282 } | 298 } |
| 283 | 299 |
| 284 void V8::InitializeOncePerProcess() { | 300 void V8::InitializeOncePerProcess() { |
| 285 CallOnce(&init_once, &InitializeOncePerProcessImpl); | 301 CallOnce(&init_once, &InitializeOncePerProcessImpl); |
| 286 } | 302 } |
| 287 | 303 |
| 288 } } // namespace v8::internal | 304 } } // namespace v8::internal |
| OLD | NEW |