Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/log.cc

Issue 2128613004: Move SimulatorHelper into V8 out of profiler clients. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressing comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/profiler/cpu-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <sstream> 8 #include <sstream>
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 bool paused_; 612 bool paused_;
613 }; 613 };
614 614
615 615
616 // 616 //
617 // Ticker used to provide ticks to the profiler and the sliding state 617 // Ticker used to provide ticks to the profiler and the sliding state
618 // window. 618 // window.
619 // 619 //
620 class Ticker: public sampler::Sampler { 620 class Ticker: public sampler::Sampler {
621 public: 621 public:
622 Ticker(Isolate* isolate, int interval): 622 Ticker(Isolate* isolate, int interval)
623 sampler::Sampler(reinterpret_cast<v8::Isolate*>(isolate)), 623 : sampler::Sampler(reinterpret_cast<v8::Isolate*>(isolate)),
624 profiler_(NULL), 624 profiler_(nullptr),
625 sampling_thread_(new SamplingThread(this, interval)) {} 625 sampling_thread_(new SamplingThread(this, interval)) {}
626 626
627 ~Ticker() { 627 ~Ticker() {
628 if (IsActive()) Stop(); 628 if (IsActive()) Stop();
629 delete sampling_thread_; 629 delete sampling_thread_;
630 } 630 }
631 631
632 void SetProfiler(Profiler* profiler) { 632 void SetProfiler(Profiler* profiler) {
633 DCHECK(profiler_ == NULL); 633 DCHECK(profiler_ == nullptr);
634 profiler_ = profiler; 634 profiler_ = profiler;
635 IncreaseProfilingDepth(); 635 IncreaseProfilingDepth();
636 if (!IsActive()) Start(); 636 if (!IsActive()) Start();
637 sampling_thread_->StartSynchronously(); 637 sampling_thread_->StartSynchronously();
638 } 638 }
639 639
640 void ClearProfiler() { 640 void ClearProfiler() {
641 profiler_ = NULL; 641 profiler_ = nullptr;
642 if (IsActive()) Stop(); 642 if (IsActive()) Stop();
643 DecreaseProfilingDepth(); 643 DecreaseProfilingDepth();
644 sampling_thread_->Join(); 644 sampling_thread_->Join();
645 } 645 }
646 646
647 void SampleStack(const v8::RegisterState& state) override { 647 void SampleStack(const v8::RegisterState& state) override {
648 if (!profiler_) return; 648 if (!profiler_) return;
649 v8::Isolate* v8_isolate = isolate(); 649 Isolate* isolate = reinterpret_cast<Isolate*>(this->isolate());
650 Isolate* i_isolate = reinterpret_cast<Isolate*>(v8_isolate);
651 #if defined(USE_SIMULATOR)
652 if (!SimulatorHelper::FillRegisters(i_isolate,
653 const_cast<v8::RegisterState*>(&state)))
654 return;
655 #endif
656 TickSample sample; 650 TickSample sample;
657 sample.Init(i_isolate, state, TickSample::kIncludeCEntryFrame, true); 651 sample.Init(isolate, state, TickSample::kIncludeCEntryFrame, true);
658 profiler_->Insert(&sample); 652 profiler_->Insert(&sample);
659 } 653 }
660 654
661 private: 655 private:
662 Profiler* profiler_; 656 Profiler* profiler_;
663 SamplingThread* sampling_thread_; 657 SamplingThread* sampling_thread_;
664 }; 658 };
665 659
666 660
667 // 661 //
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 1865
1872 if (profiler_listener_.get() != nullptr) { 1866 if (profiler_listener_.get() != nullptr) {
1873 removeCodeEventListener(profiler_listener_.get()); 1867 removeCodeEventListener(profiler_listener_.get());
1874 } 1868 }
1875 1869
1876 return log_->Close(); 1870 return log_->Close();
1877 } 1871 }
1878 1872
1879 } // namespace internal 1873 } // namespace internal
1880 } // namespace v8 1874 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/profiler/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698