| OLD | NEW | 
|---|
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 "src/libsampler/sampler.h" | 5 #include "src/libsampler/sampler.h" | 
| 6 | 6 | 
| 7 #if V8_OS_POSIX && !V8_OS_CYGWIN | 7 #if V8_OS_POSIX && !V8_OS_CYGWIN | 
| 8 | 8 | 
| 9 #define USE_SIGNALS | 9 #define USE_SIGNALS | 
| 10 | 10 | 
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 274 #if defined(USE_SIGNALS) | 274 #if defined(USE_SIGNALS) | 
| 275   void DoSample(const v8::RegisterState& state) { | 275   void DoSample(const v8::RegisterState& state) { | 
| 276     AtomicGuard atomic_guard(&SamplerManager::samplers_access_counter_, false); | 276     AtomicGuard atomic_guard(&SamplerManager::samplers_access_counter_, false); | 
| 277     if (!atomic_guard.is_success()) return; | 277     if (!atomic_guard.is_success()) return; | 
| 278     pthread_t thread_id = pthread_self(); | 278     pthread_t thread_id = pthread_self(); | 
| 279     base::HashMap::Entry* entry = | 279     base::HashMap::Entry* entry = | 
| 280         sampler_map_.Lookup(ThreadKey(thread_id), ThreadHash(thread_id)); | 280         sampler_map_.Lookup(ThreadKey(thread_id), ThreadHash(thread_id)); | 
| 281     if (!entry) return; | 281     if (!entry) return; | 
| 282     SamplerList& samplers = *static_cast<SamplerList*>(entry->value); | 282     SamplerList& samplers = *static_cast<SamplerList*>(entry->value); | 
| 283 | 283 | 
| 284     for (int i = 0; i < samplers.size(); ++i) { | 284     for (size_t i = 0; i < samplers.size(); ++i) { | 
| 285       Sampler* sampler = samplers[i]; | 285       Sampler* sampler = samplers[i]; | 
| 286       Isolate* isolate = sampler->isolate(); | 286       Isolate* isolate = sampler->isolate(); | 
| 287       // We require a fully initialized and entered isolate. | 287       // We require a fully initialized and entered isolate. | 
| 288       if (isolate == nullptr || !isolate->IsInUse()) continue; | 288       if (isolate == nullptr || !isolate->IsInUse()) continue; | 
| 289       if (v8::Locker::IsActive() && !Locker::IsLocked(isolate)) continue; | 289       if (v8::Locker::IsActive() && !Locker::IsLocked(isolate)) continue; | 
| 290       sampler->SampleStack(state); | 290       sampler->SampleStack(state); | 
| 291     } | 291     } | 
| 292   } | 292   } | 
| 293 #endif | 293 #endif | 
| 294 | 294 | 
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 654 #endif | 654 #endif | 
| 655     SampleStack(state); | 655     SampleStack(state); | 
| 656   } | 656   } | 
| 657   ResumeThread(profiled_thread); | 657   ResumeThread(profiled_thread); | 
| 658 } | 658 } | 
| 659 | 659 | 
| 660 #endif  // USE_SIGNALS | 660 #endif  // USE_SIGNALS | 
| 661 | 661 | 
| 662 }  // namespace sampler | 662 }  // namespace sampler | 
| 663 }  // namespace v8 | 663 }  // namespace v8 | 
| OLD | NEW | 
|---|