| OLD | NEW |
| 1 // Copyright 2006-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Done with the thread entirely. | 161 // Done with the thread entirely. |
| 162 delete preallocated_memory_thread_; | 162 delete preallocated_memory_thread_; |
| 163 preallocated_memory_thread_ = NULL; | 163 preallocated_memory_thread_ = NULL; |
| 164 } | 164 } |
| 165 | 165 |
| 166 | 166 |
| 167 Isolate* Isolate::default_isolate_ = NULL; | 167 Isolate* Isolate::default_isolate_ = NULL; |
| 168 Thread::LocalStorageKey Isolate::isolate_key_; | 168 Thread::LocalStorageKey Isolate::isolate_key_; |
| 169 Thread::LocalStorageKey Isolate::thread_id_key_; | 169 Thread::LocalStorageKey Isolate::thread_id_key_; |
| 170 Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_; | 170 Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_; |
| 171 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) | |
| 172 Thread::LocalStorageKey Isolate::simulator_key_; | |
| 173 #endif | |
| 174 Mutex* Isolate::process_wide_mutex_ = NULL; | 171 Mutex* Isolate::process_wide_mutex_ = NULL; |
| 175 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL; | 172 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL; |
| 176 Isolate::ThreadId Isolate::highest_thread_id_ = 0; | 173 Isolate::ThreadId Isolate::highest_thread_id_ = 0; |
| 177 | 174 |
| 178 class IsolateInitializer { | 175 class IsolateInitializer { |
| 179 public: | 176 public: |
| 180 IsolateInitializer() { | 177 IsolateInitializer() { |
| 181 Isolate::EnsureDefaultIsolate(); | 178 Isolate::EnsureDefaultIsolate(); |
| 182 } | 179 } |
| 183 }; | 180 }; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // Assume there is only one static-initializing thread. | 237 // Assume there is only one static-initializing thread. |
| 241 if (process_wide_mutex_ == NULL) { | 238 if (process_wide_mutex_ == NULL) { |
| 242 process_wide_mutex_ = OS::CreateMutex(); | 239 process_wide_mutex_ = OS::CreateMutex(); |
| 243 } | 240 } |
| 244 | 241 |
| 245 ScopedLock lock(process_wide_mutex_); | 242 ScopedLock lock(process_wide_mutex_); |
| 246 if (default_isolate_ == NULL) { | 243 if (default_isolate_ == NULL) { |
| 247 isolate_key_ = Thread::CreateThreadLocalKey(); | 244 isolate_key_ = Thread::CreateThreadLocalKey(); |
| 248 thread_id_key_ = Thread::CreateThreadLocalKey(); | 245 thread_id_key_ = Thread::CreateThreadLocalKey(); |
| 249 per_isolate_thread_data_key_ = Thread::CreateThreadLocalKey(); | 246 per_isolate_thread_data_key_ = Thread::CreateThreadLocalKey(); |
| 250 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) | |
| 251 simulator_key_ = Thread::CreateThreadLocalKey(); | |
| 252 #endif | |
| 253 thread_data_table_ = new Isolate::ThreadDataTable(); | 247 thread_data_table_ = new Isolate::ThreadDataTable(); |
| 254 default_isolate_ = new Isolate(); | 248 default_isolate_ = new Isolate(); |
| 255 } | 249 } |
| 256 Thread::SetThreadLocal(isolate_key_, default_isolate_); | 250 Thread::SetThreadLocal(isolate_key_, default_isolate_); |
| 257 CHECK(default_isolate_->PreInit()); | 251 CHECK(default_isolate_->PreInit()); |
| 258 } | 252 } |
| 259 | 253 |
| 260 | 254 |
| 261 void Isolate::EnterDefaultIsolate() { | 255 void Isolate::EnterDefaultIsolate() { |
| 262 EnsureDefaultIsolate(); | 256 EnsureDefaultIsolate(); |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 Isolate* previous_isolate = item->previous_isolate; | 730 Isolate* previous_isolate = item->previous_isolate; |
| 737 | 731 |
| 738 delete item; | 732 delete item; |
| 739 | 733 |
| 740 // Reinit the current thread for the isolate it was running before this one. | 734 // Reinit the current thread for the isolate it was running before this one. |
| 741 Thread::SetThreadLocal(per_isolate_thread_data_key_, previous_thread_data); | 735 Thread::SetThreadLocal(per_isolate_thread_data_key_, previous_thread_data); |
| 742 Thread::SetThreadLocal(isolate_key_, previous_isolate); | 736 Thread::SetThreadLocal(isolate_key_, previous_isolate); |
| 743 } | 737 } |
| 744 | 738 |
| 745 } } // namespace v8::internal | 739 } } // namespace v8::internal |
| OLD | NEW |