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

Unified Diff: src/v8.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/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()) {
« src/runtime-profiler.cc ('K') | « src/runtime-profiler.cc ('k') | src/v8threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698