Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: src/api.cc

Issue 10417010: Run Crankshaft on a separate thread. (Closed) Base URL: https://chromiumcodereview.appspot.com/10387157
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}

Powered by Google App Engine
This is Rietveld 408576698