Chromium Code Reviews| Index: src/v8.cc |
| diff --git a/src/v8.cc b/src/v8.cc |
| index 2910a0700d92223521dddf8a072fc65fb6fa9615..63b00de330a2d7b5bb46e3bdf18ad910f987e57c 100644 |
| --- a/src/v8.cc |
| +++ b/src/v8.cc |
| @@ -31,6 +31,7 @@ |
| #include "isolate.h" |
| #include "elements.h" |
| #include "bootstrapper.h" |
| +#include "crankshaft-thread.h" |
| #include "debug.h" |
| #include "deoptimizer.h" |
| #include "frames.h" |
| @@ -106,12 +107,24 @@ void V8::TearDown() { |
| if (!has_been_set_up_ || has_been_disposed_) return; |
| - ElementsAccessor::TearDown(); |
| - LOperand::TearDownCaches(); |
| - RegisteredExtension::UnregisterAll(); |
| - |
| - isolate->TearDown(); |
| - delete isolate; |
| + if (FLAG_concurrent_crankshaft) { |
| + // Lock only when required. |
| + bool to_lock = !isolate->thread_manager()->IsLockedByCurrentThread(); |
| + if (to_lock) |
| + isolate->thread_manager()->Lock(); |
| + isolate->TearDown(); |
| + // The crankshaft thread will tear down ElementsAccessor, LOperand |
| + // and RegisteredExtension once it is safe to do so. |
| + if (to_lock) |
| + isolate->thread_manager()->Unlock(); |
| + CrankshaftThread::StopThread(); |
| + } else { |
| + ElementsAccessor::TearDown(); |
|
danno
2012/05/22 10:32:19
Yikes, this tear down work should always happen he
|
| + LOperand::TearDownCaches(); |
| + RegisteredExtension::UnregisterAll(); |
| + isolate->TearDown(); |
| + delete isolate; |
| + } |
| is_running_ = false; |
| has_been_disposed_ = true; |
| @@ -252,6 +265,9 @@ Object* V8::FillHeapNumberWithRandom(Object* heap_number, |
| void V8::InitializeOncePerProcessImpl() { |
| OS::SetUp(); |
| + if (i::FLAG_concurrent_crankshaft) |
|
danno
2012/05/22 10:32:19
nit: Always use { } even around single line statem
|
| + i::CrankshaftThread::StartThread(); |
| + |
| use_crankshaft_ = FLAG_crankshaft; |
| if (Serializer::enabled()) { |