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

Unified Diff: src/isolate.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/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 0c97abd89e8e186722834fad855f9adc4141783b..94298c4e4f481ff722d4e5734cd87a2295b94aee 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1473,7 +1473,8 @@ Isolate::Isolate()
string_tracker_(NULL),
regexp_stack_(NULL),
date_cache_(NULL),
- context_exit_happened_(false) {
+ context_exit_happened_(false),
+ to_delete_(false) {
TRACE_ISOLATE(constructor);
memset(isolate_addresses_, 0,
@@ -1522,6 +1523,8 @@ Isolate::Isolate()
void Isolate::TearDown() {
TRACE_ISOLATE(tear_down);
+ ASSERT(!FLAG_concurrent_crankshaft ||
+ thread_manager()->IsLockedByCurrentThread());
// Temporarily set this isolate as current so that various parts of
// the isolate can access it in their destructors without having a
@@ -1537,10 +1540,13 @@ void Isolate::TearDown() {
thread_data_table_->RemoveAllThreads(this);
}
- if (!IsDefaultIsolate()) {
+ if (!IsDefaultIsolate() && !FLAG_concurrent_crankshaft) {
delete this;
}
+ if (FLAG_concurrent_crankshaft)
+ to_delete_ = true;
+
// Restore the previous current isolate.
SetIsolateThreadLocals(saved_isolate, saved_data);
}
@@ -1595,6 +1601,8 @@ void Isolate::SetIsolateThreadLocals(Isolate* isolate,
Isolate::~Isolate() {
TRACE_ISOLATE(destructor);
+ ASSERT(!FLAG_concurrent_crankshaft || to_delete());
+
// Has to be called while counters_ are still alive.
zone_.DeleteKeptSegment();
@@ -1881,6 +1889,13 @@ StatsTable* Isolate::stats_table() {
void Isolate::Enter() {
+ if (FLAG_concurrent_crankshaft) {
+ bool to_lock = !thread_manager()->IsLockedByCurrentThread();
+ if (to_lock)
+ thread_manager()->Lock();
+ lock_history_.Add(to_lock);
+ }
+
Isolate* current_isolate = NULL;
PerIsolateThreadData* current_data = CurrentPerIsolateThreadData();
if (current_data != NULL) {
@@ -1924,7 +1939,7 @@ void Isolate::Enter() {
}
-void Isolate::Exit() {
+void Isolate::Exit(bool auto_unlock) {
ASSERT(entry_stack_ != NULL);
ASSERT(entry_stack_->previous_thread_data == NULL ||
entry_stack_->previous_thread_data->thread_id().Equals(
@@ -1944,6 +1959,11 @@ void Isolate::Exit() {
delete item;
+ if (FLAG_concurrent_crankshaft) {
+ if (lock_history_.RemoveLast() && auto_unlock)
+ thread_manager()->Unlock();
+ }
+
// Reinit the current thread for the isolate it was running before this one.
SetIsolateThreadLocals(previous_isolate, previous_thread_data);
}

Powered by Google App Engine
This is Rietveld 408576698