| 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 | 121 #if DCHECK_IS_ON |
| 122 base::Atomic32 Isolate::isolate_key_created_ = 0; | 122 base::Atomic32 Isolate::isolate_key_created_ = 0; |
| 123 #endif | 123 #endif |
| 124 | 124 |
| 125 Isolate::PerIsolateThreadData* | 125 Isolate::PerIsolateThreadData* |
| 126 Isolate::FindOrAllocatePerThreadDataForThisThread() { | 126 Isolate::FindOrAllocatePerThreadDataForThisThread() { |
| 127 ThreadId thread_id = ThreadId::Current(); | 127 ThreadId thread_id = ThreadId::Current(); |
| 128 PerIsolateThreadData* per_thread = NULL; | 128 PerIsolateThreadData* per_thread = NULL; |
| 129 { | 129 { |
| 130 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); | 130 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); |
| 131 per_thread = thread_data_table_->Lookup(this, thread_id); | 131 per_thread = thread_data_table_->Lookup(this, thread_id); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 153 per_thread = thread_data_table_->Lookup(this, thread_id); | 153 per_thread = thread_data_table_->Lookup(this, thread_id); |
| 154 } | 154 } |
| 155 return per_thread; | 155 return per_thread; |
| 156 } | 156 } |
| 157 | 157 |
| 158 | 158 |
| 159 void Isolate::InitializeOncePerProcess() { | 159 void Isolate::InitializeOncePerProcess() { |
| 160 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); | 160 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); |
| 161 CHECK(thread_data_table_ == NULL); | 161 CHECK(thread_data_table_ == NULL); |
| 162 isolate_key_ = base::Thread::CreateThreadLocalKey(); | 162 isolate_key_ = base::Thread::CreateThreadLocalKey(); |
| 163 #if DEBUG | 163 #if DCHECK_IS_ON |
| 164 base::NoBarrier_Store(&isolate_key_created_, 1); | 164 base::NoBarrier_Store(&isolate_key_created_, 1); |
| 165 #endif | 165 #endif |
| 166 thread_id_key_ = base::Thread::CreateThreadLocalKey(); | 166 thread_id_key_ = base::Thread::CreateThreadLocalKey(); |
| 167 per_isolate_thread_data_key_ = base::Thread::CreateThreadLocalKey(); | 167 per_isolate_thread_data_key_ = base::Thread::CreateThreadLocalKey(); |
| 168 thread_data_table_ = new Isolate::ThreadDataTable(); | 168 thread_data_table_ = new Isolate::ThreadDataTable(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 Address Isolate::get_address_from_id(Isolate::AddressId id) { | 172 Address Isolate::get_address_from_id(Isolate::AddressId id) { |
| 173 return isolate_addresses_[id]; | 173 return isolate_addresses_[id]; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) { | 222 void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) { |
| 223 for (DeferredHandles* deferred = deferred_handles_head_; | 223 for (DeferredHandles* deferred = deferred_handles_head_; |
| 224 deferred != NULL; | 224 deferred != NULL; |
| 225 deferred = deferred->next_) { | 225 deferred = deferred->next_) { |
| 226 deferred->Iterate(visitor); | 226 deferred->Iterate(visitor); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 | 230 |
| 231 #ifdef DEBUG | 231 #if DCHECK_IS_ON |
| 232 bool Isolate::IsDeferredHandle(Object** handle) { | 232 bool Isolate::IsDeferredHandle(Object** handle) { |
| 233 // Each DeferredHandles instance keeps the handles to one job in the | 233 // Each DeferredHandles instance keeps the handles to one job in the |
| 234 // concurrent recompilation queue, containing a list of blocks. Each block | 234 // concurrent recompilation queue, containing a list of blocks. Each block |
| 235 // contains kHandleBlockSize handles except for the first block, which may | 235 // contains kHandleBlockSize handles except for the first block, which may |
| 236 // not be fully filled. | 236 // not be fully filled. |
| 237 // We iterate through all the blocks to see whether the argument handle | 237 // We iterate through all the blocks to see whether the argument handle |
| 238 // belongs to one of the blocks. If so, it is deferred. | 238 // belongs to one of the blocks. If so, it is deferred. |
| 239 for (DeferredHandles* deferred = deferred_handles_head_; | 239 for (DeferredHandles* deferred = deferred_handles_head_; |
| 240 deferred != NULL; | 240 deferred != NULL; |
| 241 deferred = deferred->next_) { | 241 deferred = deferred->next_) { |
| (...skipping 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2341 DCHECK(0 <= index && index < CallDescriptors::NUMBER_OF_DESCRIPTORS); | 2341 DCHECK(0 <= index && index < CallDescriptors::NUMBER_OF_DESCRIPTORS); |
| 2342 return &call_descriptor_data_[index]; | 2342 return &call_descriptor_data_[index]; |
| 2343 } | 2343 } |
| 2344 | 2344 |
| 2345 | 2345 |
| 2346 Object* Isolate::FindCodeObject(Address a) { | 2346 Object* Isolate::FindCodeObject(Address a) { |
| 2347 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a); | 2347 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a); |
| 2348 } | 2348 } |
| 2349 | 2349 |
| 2350 | 2350 |
| 2351 #ifdef DEBUG | 2351 #if DCHECK_IS_ON |
| 2352 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2352 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 2353 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2353 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 2354 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2354 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 2355 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2355 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 2356 #undef ISOLATE_FIELD_OFFSET | 2356 #undef ISOLATE_FIELD_OFFSET |
| 2357 #endif | 2357 #endif |
| 2358 | 2358 |
| 2359 | 2359 |
| 2360 Handle<JSObject> Isolate::GetSymbolRegistry() { | 2360 Handle<JSObject> Isolate::GetSymbolRegistry() { |
| 2361 if (heap()->symbol_registry()->IsSmi()) { | 2361 if (heap()->symbol_registry()->IsSmi()) { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 if (prev_ && prev_->Intercept(flag)) return true; | 2549 if (prev_ && prev_->Intercept(flag)) return true; |
| 2550 // Then check whether this scope intercepts. | 2550 // Then check whether this scope intercepts. |
| 2551 if ((flag & intercept_mask_)) { | 2551 if ((flag & intercept_mask_)) { |
| 2552 intercepted_flags_ |= flag; | 2552 intercepted_flags_ |= flag; |
| 2553 return true; | 2553 return true; |
| 2554 } | 2554 } |
| 2555 return false; | 2555 return false; |
| 2556 } | 2556 } |
| 2557 | 2557 |
| 2558 } } // namespace v8::internal | 2558 } } // namespace v8::internal |
| OLD | NEW |