| 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() {
|
|
|