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 RegisterState updated_state; |
651 if (!SimulatorHelper::FillRegisters(i_isolate, ®s)) return; | 651 sample.Init(isolate, state, updated_state, TickSample::kIncludeCEntryFrame, |
652 #else | 652 true); |
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); | 653 profiler_->Insert(&sample); |
658 } | 654 } |
659 | 655 |
660 private: | 656 private: |
661 Profiler* profiler_; | 657 Profiler* profiler_; |
662 SamplingThread* sampling_thread_; | 658 SamplingThread* sampling_thread_; |
663 }; | 659 }; |
664 | 660 |
665 | 661 |
666 // | 662 // |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 | 1866 |
1871 if (profiler_listener_.get() != nullptr) { | 1867 if (profiler_listener_.get() != nullptr) { |
1872 removeCodeEventListener(profiler_listener_.get()); | 1868 removeCodeEventListener(profiler_listener_.get()); |
1873 } | 1869 } |
1874 | 1870 |
1875 return log_->Close(); | 1871 return log_->Close(); |
1876 } | 1872 } |
1877 | 1873 |
1878 } // namespace internal | 1874 } // namespace internal |
1879 } // namespace v8 | 1875 } // namespace v8 |
OLD | NEW |