OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/log.h" | 5 #include "src/log.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <memory> | 8 #include <memory> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 | 638 |
639 void ClearProfiler() { | 639 void ClearProfiler() { |
640 profiler_ = nullptr; | 640 profiler_ = nullptr; |
641 if (IsActive()) Stop(); | 641 if (IsActive()) Stop(); |
642 DecreaseProfilingDepth(); | 642 DecreaseProfilingDepth(); |
643 sampling_thread_->Join(); | 643 sampling_thread_->Join(); |
644 } | 644 } |
645 | 645 |
646 void SampleStack(const v8::RegisterState& state) override { | 646 void SampleStack(const v8::RegisterState& state) override { |
647 if (!profiler_) return; | 647 if (!profiler_) return; |
648 #if defined(USE_SIMULATOR) | 648 Isolate* isolate = reinterpret_cast<Isolate*>(this->isolate()); |
649 Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate()); | 649 TickSample sample; |
650 v8::RegisterState regs; | 650 sample.Init(isolate, state, TickSample::kIncludeCEntryFrame, true); |
651 if (!SimulatorHelper::FillRegisters(i_isolate, ®s)) return; | |
652 #else | |
653 const v8::RegisterState& regs = state; | |
654 #endif | |
655 v8::TickSample sample; | |
656 sample.Init(isolate(), regs, v8::TickSample::kIncludeCEntryFrame, true); | |
657 profiler_->Insert(&sample); | 651 profiler_->Insert(&sample); |
658 } | 652 } |
659 | 653 |
660 private: | 654 private: |
661 Profiler* profiler_; | 655 Profiler* profiler_; |
662 SamplingThread* sampling_thread_; | 656 SamplingThread* sampling_thread_; |
663 }; | 657 }; |
664 | 658 |
665 | 659 |
666 // | 660 // |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 | 1856 |
1863 if (profiler_listener_.get() != nullptr) { | 1857 if (profiler_listener_.get() != nullptr) { |
1864 removeCodeEventListener(profiler_listener_.get()); | 1858 removeCodeEventListener(profiler_listener_.get()); |
1865 } | 1859 } |
1866 | 1860 |
1867 return log_->Close(); | 1861 return log_->Close(); |
1868 } | 1862 } |
1869 | 1863 |
1870 } // namespace internal | 1864 } // namespace internal |
1871 } // namespace v8 | 1865 } // namespace v8 |
OLD | NEW |