OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 while (promise_on_stack_) isolate_->PopPromise(); | 111 while (promise_on_stack_) isolate_->PopPromise(); |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 base::Thread::LocalStorageKey Isolate::isolate_key_; | 115 base::Thread::LocalStorageKey Isolate::isolate_key_; |
116 base::Thread::LocalStorageKey Isolate::thread_id_key_; | 116 base::Thread::LocalStorageKey Isolate::thread_id_key_; |
117 base::Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_; | 117 base::Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_; |
118 base::LazyMutex Isolate::thread_data_table_mutex_ = LAZY_MUTEX_INITIALIZER; | 118 base::LazyMutex Isolate::thread_data_table_mutex_ = LAZY_MUTEX_INITIALIZER; |
119 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL; | 119 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL; |
120 base::Atomic32 Isolate::isolate_counter_ = 0; | 120 base::Atomic32 Isolate::isolate_counter_ = 0; |
| 121 #if DEBUG |
| 122 base::Atomic32 Isolate::isolate_key_created_ = 0; |
| 123 #endif |
121 | 124 |
122 Isolate::PerIsolateThreadData* | 125 Isolate::PerIsolateThreadData* |
123 Isolate::FindOrAllocatePerThreadDataForThisThread() { | 126 Isolate::FindOrAllocatePerThreadDataForThisThread() { |
124 ThreadId thread_id = ThreadId::Current(); | 127 ThreadId thread_id = ThreadId::Current(); |
125 PerIsolateThreadData* per_thread = NULL; | 128 PerIsolateThreadData* per_thread = NULL; |
126 { | 129 { |
127 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); | 130 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); |
128 per_thread = thread_data_table_->Lookup(this, thread_id); | 131 per_thread = thread_data_table_->Lookup(this, thread_id); |
129 if (per_thread == NULL) { | 132 if (per_thread == NULL) { |
130 per_thread = new PerIsolateThreadData(this, thread_id); | 133 per_thread = new PerIsolateThreadData(this, thread_id); |
(...skipping 19 matching lines...) Expand all Loading... |
150 per_thread = thread_data_table_->Lookup(this, thread_id); | 153 per_thread = thread_data_table_->Lookup(this, thread_id); |
151 } | 154 } |
152 return per_thread; | 155 return per_thread; |
153 } | 156 } |
154 | 157 |
155 | 158 |
156 void Isolate::InitializeOncePerProcess() { | 159 void Isolate::InitializeOncePerProcess() { |
157 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); | 160 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); |
158 CHECK(thread_data_table_ == NULL); | 161 CHECK(thread_data_table_ == NULL); |
159 isolate_key_ = base::Thread::CreateThreadLocalKey(); | 162 isolate_key_ = base::Thread::CreateThreadLocalKey(); |
| 163 #if DEBUG |
| 164 base::NoBarrier_Store(&isolate_key_created_, 1); |
| 165 #endif |
160 thread_id_key_ = base::Thread::CreateThreadLocalKey(); | 166 thread_id_key_ = base::Thread::CreateThreadLocalKey(); |
161 per_isolate_thread_data_key_ = base::Thread::CreateThreadLocalKey(); | 167 per_isolate_thread_data_key_ = base::Thread::CreateThreadLocalKey(); |
162 thread_data_table_ = new Isolate::ThreadDataTable(); | 168 thread_data_table_ = new Isolate::ThreadDataTable(); |
163 } | 169 } |
164 | 170 |
165 | 171 |
166 Address Isolate::get_address_from_id(Isolate::AddressId id) { | 172 Address Isolate::get_address_from_id(Isolate::AddressId id) { |
167 return isolate_addresses_[id]; | 173 return isolate_addresses_[id]; |
168 } | 174 } |
169 | 175 |
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2543 if (prev_ && prev_->Intercept(flag)) return true; | 2549 if (prev_ && prev_->Intercept(flag)) return true; |
2544 // Then check whether this scope intercepts. | 2550 // Then check whether this scope intercepts. |
2545 if ((flag & intercept_mask_)) { | 2551 if ((flag & intercept_mask_)) { |
2546 intercepted_flags_ |= flag; | 2552 intercepted_flags_ |= flag; |
2547 return true; | 2553 return true; |
2548 } | 2554 } |
2549 return false; | 2555 return false; |
2550 } | 2556 } |
2551 | 2557 |
2552 } } // namespace v8::internal | 2558 } } // namespace v8::internal |
OLD | NEW |