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 "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 void ThreadLocalTop::Free() { | 105 void ThreadLocalTop::Free() { |
106 // Match unmatched PopPromise calls. | 106 // Match unmatched PopPromise calls. |
107 while (promise_on_stack_) isolate_->PopPromise(); | 107 while (promise_on_stack_) isolate_->PopPromise(); |
108 } | 108 } |
109 | 109 |
110 | 110 |
111 base::Thread::LocalStorageKey Isolate::isolate_key_; | 111 base::Thread::LocalStorageKey Isolate::isolate_key_; |
112 base::Thread::LocalStorageKey Isolate::thread_id_key_; | 112 base::Thread::LocalStorageKey Isolate::thread_id_key_; |
113 base::Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_; | 113 base::Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_; |
114 #ifdef DEBUG | |
115 base::Thread::LocalStorageKey PerThreadAssertScopeBase::thread_local_key; | |
116 #endif // DEBUG | |
117 base::LazyMutex Isolate::thread_data_table_mutex_ = LAZY_MUTEX_INITIALIZER; | 114 base::LazyMutex Isolate::thread_data_table_mutex_ = LAZY_MUTEX_INITIALIZER; |
118 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL; | 115 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL; |
119 base::Atomic32 Isolate::isolate_counter_ = 0; | 116 base::Atomic32 Isolate::isolate_counter_ = 0; |
120 | 117 |
121 Isolate::PerIsolateThreadData* | 118 Isolate::PerIsolateThreadData* |
122 Isolate::FindOrAllocatePerThreadDataForThisThread() { | 119 Isolate::FindOrAllocatePerThreadDataForThisThread() { |
123 ThreadId thread_id = ThreadId::Current(); | 120 ThreadId thread_id = ThreadId::Current(); |
124 PerIsolateThreadData* per_thread = NULL; | 121 PerIsolateThreadData* per_thread = NULL; |
125 { | 122 { |
126 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); | 123 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); |
(...skipping 24 matching lines...) Expand all Loading... |
151 return per_thread; | 148 return per_thread; |
152 } | 149 } |
153 | 150 |
154 | 151 |
155 void Isolate::InitializeOncePerProcess() { | 152 void Isolate::InitializeOncePerProcess() { |
156 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); | 153 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); |
157 CHECK(thread_data_table_ == NULL); | 154 CHECK(thread_data_table_ == NULL); |
158 isolate_key_ = base::Thread::CreateThreadLocalKey(); | 155 isolate_key_ = base::Thread::CreateThreadLocalKey(); |
159 thread_id_key_ = base::Thread::CreateThreadLocalKey(); | 156 thread_id_key_ = base::Thread::CreateThreadLocalKey(); |
160 per_isolate_thread_data_key_ = base::Thread::CreateThreadLocalKey(); | 157 per_isolate_thread_data_key_ = base::Thread::CreateThreadLocalKey(); |
161 #ifdef DEBUG | |
162 PerThreadAssertScopeBase::thread_local_key = | |
163 base::Thread::CreateThreadLocalKey(); | |
164 #endif // DEBUG | |
165 thread_data_table_ = new Isolate::ThreadDataTable(); | 158 thread_data_table_ = new Isolate::ThreadDataTable(); |
166 } | 159 } |
167 | 160 |
168 | 161 |
169 Address Isolate::get_address_from_id(Isolate::AddressId id) { | 162 Address Isolate::get_address_from_id(Isolate::AddressId id) { |
170 return isolate_addresses_[id]; | 163 return isolate_addresses_[id]; |
171 } | 164 } |
172 | 165 |
173 | 166 |
174 char* Isolate::Iterate(ObjectVisitor* v, char* thread_storage) { | 167 char* Isolate::Iterate(ObjectVisitor* v, char* thread_storage) { |
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 if (prev_ && prev_->Intercept(flag)) return true; | 2387 if (prev_ && prev_->Intercept(flag)) return true; |
2395 // Then check whether this scope intercepts. | 2388 // Then check whether this scope intercepts. |
2396 if ((flag & intercept_mask_)) { | 2389 if ((flag & intercept_mask_)) { |
2397 intercepted_flags_ |= flag; | 2390 intercepted_flags_ |= flag; |
2398 return true; | 2391 return true; |
2399 } | 2392 } |
2400 return false; | 2393 return false; |
2401 } | 2394 } |
2402 | 2395 |
2403 } } // namespace v8::internal | 2396 } } // namespace v8::internal |
OLD | NEW |