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