OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 instance_->Start(); | 676 instance_->Start(); |
677 } else { | 677 } else { |
678 ASSERT(instance_->interval_ == sampler->interval()); | 678 ASSERT(instance_->interval_ == sampler->interval()); |
679 } | 679 } |
680 } | 680 } |
681 | 681 |
682 static void RemoveActiveSampler(Sampler* sampler) { | 682 static void RemoveActiveSampler(Sampler* sampler) { |
683 ScopedLock lock(mutex_); | 683 ScopedLock lock(mutex_); |
684 SamplerRegistry::RemoveActiveSampler(sampler); | 684 SamplerRegistry::RemoveActiveSampler(sampler); |
685 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { | 685 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { |
686 RuntimeProfiler::WakeUpRuntimeProfilerThreadBeforeShutdown(); | 686 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); |
687 instance_->Join(); | |
688 delete instance_; | 687 delete instance_; |
689 instance_ = NULL; | 688 instance_ = NULL; |
690 RestoreSignalHandler(); | 689 RestoreSignalHandler(); |
691 } | 690 } |
692 } | 691 } |
693 | 692 |
694 // Implement Thread::Run(). | 693 // Implement Thread::Run(). |
695 virtual void Run() { | 694 virtual void Run() { |
696 SamplerRegistry::State state; | 695 SamplerRegistry::State state; |
697 while ((state = SamplerRegistry::GetState()) != | 696 while ((state = SamplerRegistry::GetState()) != |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 | 813 |
815 void Sampler::Stop() { | 814 void Sampler::Stop() { |
816 ASSERT(IsActive()); | 815 ASSERT(IsActive()); |
817 SignalSender::RemoveActiveSampler(this); | 816 SignalSender::RemoveActiveSampler(this); |
818 SetActive(false); | 817 SetActive(false); |
819 } | 818 } |
820 | 819 |
821 #endif // ENABLE_LOGGING_AND_PROFILING | 820 #endif // ENABLE_LOGGING_AND_PROFILING |
822 | 821 |
823 } } // namespace v8::internal | 822 } } // namespace v8::internal |
OLD | NEW |