OLD | NEW |
1 // Copyright 2006-2011 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 instance_->Start(); | 639 instance_->Start(); |
640 } else { | 640 } else { |
641 ASSERT(instance_->interval_ == sampler->interval()); | 641 ASSERT(instance_->interval_ == sampler->interval()); |
642 } | 642 } |
643 } | 643 } |
644 | 644 |
645 static void RemoveActiveSampler(Sampler* sampler) { | 645 static void RemoveActiveSampler(Sampler* sampler) { |
646 ScopedLock lock(mutex_); | 646 ScopedLock lock(mutex_); |
647 SamplerRegistry::RemoveActiveSampler(sampler); | 647 SamplerRegistry::RemoveActiveSampler(sampler); |
648 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { | 648 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { |
649 RuntimeProfiler::WakeUpRuntimeProfilerThreadBeforeShutdown(); | 649 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); |
650 instance_->Join(); | |
651 delete instance_; | 650 delete instance_; |
652 instance_ = NULL; | 651 instance_ = NULL; |
653 } | 652 } |
654 } | 653 } |
655 | 654 |
656 // Implement Thread::Run(). | 655 // Implement Thread::Run(). |
657 virtual void Run() { | 656 virtual void Run() { |
658 SamplerRegistry::State state; | 657 SamplerRegistry::State state; |
659 while ((state = SamplerRegistry::GetState()) != | 658 while ((state = SamplerRegistry::GetState()) != |
660 SamplerRegistry::HAS_NO_SAMPLERS) { | 659 SamplerRegistry::HAS_NO_SAMPLERS) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 void Sampler::Stop() { | 766 void Sampler::Stop() { |
768 ASSERT(IsActive()); | 767 ASSERT(IsActive()); |
769 SamplerThread::RemoveActiveSampler(this); | 768 SamplerThread::RemoveActiveSampler(this); |
770 SetActive(false); | 769 SetActive(false); |
771 } | 770 } |
772 | 771 |
773 #endif // ENABLE_LOGGING_AND_PROFILING | 772 #endif // ENABLE_LOGGING_AND_PROFILING |
774 | 773 |
775 } } // namespace v8::internal | 774 } } // namespace v8::internal |
776 | 775 |
OLD | NEW |