Chromium Code Reviews| Index: src/isolate.cc |
| diff --git a/src/isolate.cc b/src/isolate.cc |
| index bcd48945f2816b95b7c542cc9477b37e99dbe40c..cbb12256fe530268bbeda895a15951593d20410e 100644 |
| --- a/src/isolate.cc |
| +++ b/src/isolate.cc |
| @@ -343,7 +343,7 @@ Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_; |
| #ifdef DEBUG |
| Thread::LocalStorageKey PerThreadAssertScopeBase::thread_local_key; |
| #endif // DEBUG |
| -Mutex* Isolate::process_wide_mutex_ = OS::CreateMutex(); |
| +Mutex Isolate::process_wide_mutex_; |
| Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL; |
| Atomic32 Isolate::isolate_counter_ = 0; |
| @@ -352,7 +352,7 @@ Isolate::PerIsolateThreadData* Isolate::AllocatePerIsolateThreadData( |
| ASSERT(!thread_id.Equals(ThreadId::Invalid())); |
| PerIsolateThreadData* per_thread = new PerIsolateThreadData(this, thread_id); |
| { |
| - ScopedLock lock(process_wide_mutex_); |
| + ScopedLock lock(&process_wide_mutex_); |
| ASSERT(thread_data_table_->Lookup(this, thread_id) == NULL); |
| thread_data_table_->Insert(per_thread); |
| ASSERT(thread_data_table_->Lookup(this, thread_id) == per_thread); |
| @@ -366,11 +366,11 @@ Isolate::PerIsolateThreadData* |
| ThreadId thread_id = ThreadId::Current(); |
| PerIsolateThreadData* per_thread = NULL; |
| { |
| - ScopedLock lock(process_wide_mutex_); |
| + ScopedLock lock(&process_wide_mutex_); |
| per_thread = thread_data_table_->Lookup(this, thread_id); |
| - if (per_thread == NULL) { |
| - per_thread = AllocatePerIsolateThreadData(thread_id); |
| - } |
| + } |
| + if (per_thread == NULL) { |
| + per_thread = AllocatePerIsolateThreadData(thread_id); |
|
Sven Panne
2013/07/30 15:09:56
Why is it OK to move this outside the ScopedLock?
Benedikt Meurer
2013/07/30 16:50:52
Because AllocatePerIsolateThreadData() acquires th
|
| } |
| return per_thread; |
| } |
| @@ -386,7 +386,7 @@ Isolate::PerIsolateThreadData* Isolate::FindPerThreadDataForThread( |
| ThreadId thread_id) { |
| PerIsolateThreadData* per_thread = NULL; |
| { |
| - ScopedLock lock(process_wide_mutex_); |
| + ScopedLock lock(&process_wide_mutex_); |
| per_thread = thread_data_table_->Lookup(this, thread_id); |
| } |
| return per_thread; |
| @@ -394,7 +394,7 @@ Isolate::PerIsolateThreadData* Isolate::FindPerThreadDataForThread( |
| void Isolate::EnsureDefaultIsolate() { |
| - ScopedLock lock(process_wide_mutex_); |
| + ScopedLock lock(&process_wide_mutex_); |
| if (default_isolate_ == NULL) { |
| isolate_key_ = Thread::CreateThreadLocalKey(); |
| thread_id_key_ = Thread::CreateThreadLocalKey(); |
| @@ -1749,10 +1749,8 @@ Isolate::Isolate() |
| counters_(NULL), |
| code_range_(NULL), |
| // Must be initialized early to allow v8::SetResourceConstraints calls. |
| - break_access_(OS::CreateMutex()), |
| debugger_initialized_(false), |
| // Must be initialized early to allow v8::Debug calls. |
| - debugger_access_(OS::CreateMutex()), |
| logger_(NULL), |
| stats_table_(NULL), |
| stub_cache_(NULL), |
| @@ -1853,7 +1851,7 @@ void Isolate::TearDown() { |
| Deinit(); |
| - { ScopedLock lock(process_wide_mutex_); |
| + { ScopedLock lock(&process_wide_mutex_); |
| thread_data_table_->RemoveAllThreads(this); |
| } |
| @@ -2024,10 +2022,6 @@ Isolate::~Isolate() { |
| delete handle_scope_implementer_; |
| handle_scope_implementer_ = NULL; |
| - delete break_access_; |
| - break_access_ = NULL; |
| - delete debugger_access_; |
| - debugger_access_ = NULL; |
| delete compilation_cache_; |
| compilation_cache_ = NULL; |
| @@ -2127,7 +2121,7 @@ void Isolate::InitializeLoggingAndCounters() { |
| void Isolate::InitializeDebugger() { |
| #ifdef ENABLE_DEBUGGER_SUPPORT |
| - ScopedLock lock(debugger_access_); |
| + ScopedLock lock(&debugger_access_); |
| if (NoBarrier_Load(&debugger_initialized_)) return; |
| InitializeLoggingAndCounters(); |
| debug_ = new Debug(this); |