Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 52a84edfdabf6e797b3d87cd1b2786eb6bfdd5a2..0f6b9b6e8553a95273e675ae9c7c87399740494d 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -36,6 +36,7 @@ |
| #include "compiler.h" |
| #include "conversions-inl.h" |
| #include "counters.h" |
| +#include "crankshaft-thread.h" |
|
danno
2012/05/22 10:32:19
crankshaft -> optimizing_compiler
|
| #include "debug.h" |
| #include "deoptimizer.h" |
| #include "execution.h" |
| @@ -5377,12 +5378,25 @@ Isolate* Isolate::New() { |
| void Isolate::Dispose() { |
| i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| + bool to_lock = false; |
| + |
| + if (i::FLAG_concurrent_crankshaft) { |
| + // We need to acquire the Isolate lock before tearing it down |
| + // since the crankshaft thread could be compiling a function in |
| + // this isolate. |
| + to_lock = !isolate->thread_manager()->IsLockedByCurrentThread(); |
| + if (to_lock) |
| + isolate->thread_manager()->Lock(); |
| + } |
| + |
| if (!ApiCheck(!isolate->IsInUse(), |
| "v8::Isolate::Dispose()", |
| "Disposing the isolate that is entered by a thread.")) { |
| return; |
| } |
| isolate->TearDown(); |
|
danno
2012/05/22 10:32:19
How do you ensure that the compiler thread properl
sanjoy
2012/05/22 11:38:55
V8::TearDown stops the compiler thread.
|
| + if (to_lock) |
| + isolate->thread_manager()->Unlock(); |
| } |