| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/sampler.h" | 5 #include "src/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 20 matching lines...) Expand all Loading... |
| 31 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'. | 31 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'. |
| 32 // Old versions of the C library <signal.h> didn't define the type. | 32 // Old versions of the C library <signal.h> didn't define the type. |
| 33 #if V8_OS_ANDROID && !defined(__BIONIC_HAVE_UCONTEXT_T) && \ | 33 #if V8_OS_ANDROID && !defined(__BIONIC_HAVE_UCONTEXT_T) && \ |
| 34 (defined(__arm__) || defined(__aarch64__)) && \ | 34 (defined(__arm__) || defined(__aarch64__)) && \ |
| 35 !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) | 35 !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) |
| 36 #include <asm/sigcontext.h> | 36 #include <asm/sigcontext.h> |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 #elif V8_OS_WIN || V8_OS_CYGWIN | 39 #elif V8_OS_WIN || V8_OS_CYGWIN |
| 40 | 40 |
| 41 #include "src/win32-headers.h" | 41 #include "src/base/win32-headers.h" |
| 42 | 42 |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 #include "src/v8.h" | 45 #include "src/v8.h" |
| 46 | 46 |
| 47 #include "src/cpu-profiler-inl.h" | 47 #include "src/cpu-profiler-inl.h" |
| 48 #include "src/flags.h" | 48 #include "src/flags.h" |
| 49 #include "src/frames-inl.h" | 49 #include "src/frames-inl.h" |
| 50 #include "src/log.h" | 50 #include "src/log.h" |
| 51 #include "src/platform.h" | 51 #include "src/platform.h" |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 | 647 |
| 648 | 648 |
| 649 void Sampler::Stop() { | 649 void Sampler::Stop() { |
| 650 ASSERT(IsActive()); | 650 ASSERT(IsActive()); |
| 651 SamplerThread::RemoveActiveSampler(this); | 651 SamplerThread::RemoveActiveSampler(this); |
| 652 SetActive(false); | 652 SetActive(false); |
| 653 } | 653 } |
| 654 | 654 |
| 655 | 655 |
| 656 void Sampler::IncreaseProfilingDepth() { | 656 void Sampler::IncreaseProfilingDepth() { |
| 657 NoBarrier_AtomicIncrement(&profiling_, 1); | 657 base::NoBarrier_AtomicIncrement(&profiling_, 1); |
| 658 #if defined(USE_SIGNALS) | 658 #if defined(USE_SIGNALS) |
| 659 SignalHandler::IncreaseSamplerCount(); | 659 SignalHandler::IncreaseSamplerCount(); |
| 660 #endif | 660 #endif |
| 661 } | 661 } |
| 662 | 662 |
| 663 | 663 |
| 664 void Sampler::DecreaseProfilingDepth() { | 664 void Sampler::DecreaseProfilingDepth() { |
| 665 #if defined(USE_SIGNALS) | 665 #if defined(USE_SIGNALS) |
| 666 SignalHandler::DecreaseSamplerCount(); | 666 SignalHandler::DecreaseSamplerCount(); |
| 667 #endif | 667 #endif |
| 668 NoBarrier_AtomicIncrement(&profiling_, -1); | 668 base::NoBarrier_AtomicIncrement(&profiling_, -1); |
| 669 } | 669 } |
| 670 | 670 |
| 671 | 671 |
| 672 void Sampler::SampleStack(const RegisterState& state) { | 672 void Sampler::SampleStack(const RegisterState& state) { |
| 673 TickSample* sample = isolate_->cpu_profiler()->StartTickSample(); | 673 TickSample* sample = isolate_->cpu_profiler()->StartTickSample(); |
| 674 TickSample sample_obj; | 674 TickSample sample_obj; |
| 675 if (sample == NULL) sample = &sample_obj; | 675 if (sample == NULL) sample = &sample_obj; |
| 676 sample->Init(isolate_, state); | 676 sample->Init(isolate_, state); |
| 677 if (is_counting_samples_) { | 677 if (is_counting_samples_) { |
| 678 if (sample->state == JS || sample->state == EXTERNAL) { | 678 if (sample->state == JS || sample->state == EXTERNAL) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 #endif // USE_SIMULATOR | 728 #endif // USE_SIMULATOR |
| 729 SampleStack(state); | 729 SampleStack(state); |
| 730 } | 730 } |
| 731 ResumeThread(profiled_thread); | 731 ResumeThread(profiled_thread); |
| 732 } | 732 } |
| 733 | 733 |
| 734 #endif // USE_SIGNALS | 734 #endif // USE_SIGNALS |
| 735 | 735 |
| 736 | 736 |
| 737 } } // namespace v8::internal | 737 } } // namespace v8::internal |
| OLD | NEW |