| 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 #if defined(USE_SIGNALS) | 595 #if defined(USE_SIGNALS) |
| 596 SamplerManager::instance()->RemoveSampler(this); | 596 SamplerManager::instance()->RemoveSampler(this); |
| 597 #endif | 597 #endif |
| 598 DCHECK(IsActive()); | 598 DCHECK(IsActive()); |
| 599 SetActive(false); | 599 SetActive(false); |
| 600 SetRegistered(false); | 600 SetRegistered(false); |
| 601 } | 601 } |
| 602 | 602 |
| 603 | 603 |
| 604 void Sampler::IncreaseProfilingDepth() { | 604 void Sampler::IncreaseProfilingDepth() { |
| 605 base::NoBarrier_AtomicIncrement(&profiling_, 1); | 605 base::Relaxed_AtomicIncrement(&profiling_, 1); |
| 606 #if defined(USE_SIGNALS) | 606 #if defined(USE_SIGNALS) |
| 607 SignalHandler::IncreaseSamplerCount(); | 607 SignalHandler::IncreaseSamplerCount(); |
| 608 #endif | 608 #endif |
| 609 } | 609 } |
| 610 | 610 |
| 611 | 611 |
| 612 void Sampler::DecreaseProfilingDepth() { | 612 void Sampler::DecreaseProfilingDepth() { |
| 613 #if defined(USE_SIGNALS) | 613 #if defined(USE_SIGNALS) |
| 614 SignalHandler::DecreaseSamplerCount(); | 614 SignalHandler::DecreaseSamplerCount(); |
| 615 #endif | 615 #endif |
| 616 base::NoBarrier_AtomicIncrement(&profiling_, -1); | 616 base::Relaxed_AtomicIncrement(&profiling_, -1); |
| 617 } | 617 } |
| 618 | 618 |
| 619 | 619 |
| 620 #if defined(USE_SIGNALS) | 620 #if defined(USE_SIGNALS) |
| 621 | 621 |
| 622 void Sampler::DoSample() { | 622 void Sampler::DoSample() { |
| 623 if (!SignalHandler::Installed()) return; | 623 if (!SignalHandler::Installed()) return; |
| 624 if (!IsActive() && !IsRegistered()) { | 624 if (!IsActive() && !IsRegistered()) { |
| 625 SamplerManager::instance()->AddSampler(this); | 625 SamplerManager::instance()->AddSampler(this); |
| 626 SetRegistered(true); | 626 SetRegistered(true); |
| (...skipping 27 matching lines...) Expand all 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 |