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

Unified Diff: src/handles-inl.h

Issue 10417010: Run Crankshaft on a separate thread. (Closed) Base URL: https://chromiumcodereview.appspot.com/10387157
Patch Set: Set optimize_in_parallel to false by default. 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
« no previous file with comments | « src/handles.h ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles-inl.h
diff --git a/src/handles-inl.h b/src/handles-inl.h
index a5c81cec56f1d0056be0d1066683fc27432a4362..47ca378095b1c3e8ab87f85a120dee734902768c 100644
--- a/src/handles-inl.h
+++ b/src/handles-inl.h
@@ -33,6 +33,7 @@
#include "apiutils.h"
#include "handles.h"
#include "isolate.h"
+#include "v8threads.h"
namespace v8 {
namespace internal {
@@ -69,6 +70,15 @@ inline T* Handle<T>::operator*() const {
HandleScope::HandleScope() {
Isolate* isolate = Isolate::Current();
+
+ if (FLAG_optimize_in_parallel &&
+ !isolate->thread_manager()->IsLockedByCurrentThread()) {
+ has_isolate_lock_ = true;
+ isolate->thread_manager()->Lock();
+ } else {
+ has_isolate_lock_ = false;
+ }
+
v8::ImplementationUtilities::HandleScopeData* current =
isolate->handle_scope_data();
isolate_ = isolate;
@@ -82,6 +92,15 @@ HandleScope::HandleScope(Isolate* isolate) {
ASSERT(isolate == Isolate::Current());
v8::ImplementationUtilities::HandleScopeData* current =
isolate->handle_scope_data();
+
+ if (FLAG_optimize_in_parallel &&
+ !isolate->thread_manager()->IsLockedByCurrentThread()) {
+ has_isolate_lock_ = true;
+ isolate->thread_manager()->Lock();
+ } else {
+ has_isolate_lock_ = false;
+ }
+
isolate_ = isolate;
prev_next_ = current->next;
prev_limit_ = current->limit;
@@ -91,6 +110,9 @@ HandleScope::HandleScope(Isolate* isolate) {
HandleScope::~HandleScope() {
CloseScope();
+ if (has_isolate_lock_) {
+ isolate_->thread_manager()->Unlock();
+ }
}
void HandleScope::CloseScope() {
« no previous file with comments | « src/handles.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698