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

Side by Side Diff: src/profiler/cpu-profiler.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/log.cc ('k') | src/profiler/tick-sample.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/profiler/cpu-profiler.h" 5 #include "src/profiler/cpu-profiler.h"
6 6
7 #include "src/debug/debug.h" 7 #include "src/debug/debug.h"
8 #include "src/deoptimizer.h" 8 #include "src/deoptimizer.h"
9 #include "src/frames-inl.h" 9 #include "src/frames-inl.h"
10 #include "src/locked-queue-inl.h" 10 #include "src/locked-queue-inl.h"
11 #include "src/log-inl.h" 11 #include "src/log-inl.h"
12 #include "src/profiler/cpu-profiler-inl.h" 12 #include "src/profiler/cpu-profiler-inl.h"
13 #include "src/vm-state-inl.h" 13 #include "src/vm-state-inl.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 static const int kProfilerStackSize = 64 * KB; 18 static const int kProfilerStackSize = 64 * KB;
19 19
20 class CpuSampler : public sampler::Sampler { 20 class CpuSampler : public sampler::Sampler {
21 public: 21 public:
22 CpuSampler(Isolate* isolate, ProfilerEventsProcessor* processor) 22 CpuSampler(Isolate* isolate, ProfilerEventsProcessor* processor)
23 : sampler::Sampler(reinterpret_cast<v8::Isolate*>(isolate)), 23 : sampler::Sampler(reinterpret_cast<v8::Isolate*>(isolate)),
24 processor_(processor) {} 24 processor_(processor) {}
25 25
26 void SampleStack(const v8::RegisterState& state) override { 26 void SampleStack(const v8::RegisterState& regs) override {
27 v8::Isolate* v8_isolate = isolate();
28 Isolate* i_isolate = reinterpret_cast<Isolate*>(v8_isolate);
29 #if defined(USE_SIMULATOR)
30 v8::RegisterState regs;
31 if (!SimulatorHelper::FillRegisters(i_isolate, &regs)) return;
32 #else
33 const v8::RegisterState& regs = state;
34 #endif
35 TickSample* sample = processor_->StartTickSample(); 27 TickSample* sample = processor_->StartTickSample();
36 if (sample == NULL) return; 28 if (sample == nullptr) return;
37 sample->Init(i_isolate, regs, TickSample::kIncludeCEntryFrame, true); 29 Isolate* isolate = reinterpret_cast<Isolate*>(this->isolate());
30 sample->Init(isolate, regs, TickSample::kIncludeCEntryFrame, true);
38 if (is_counting_samples_ && !sample->timestamp.IsNull()) { 31 if (is_counting_samples_ && !sample->timestamp.IsNull()) {
39 if (sample->state == JS) ++js_sample_count_; 32 if (sample->state == JS) ++js_sample_count_;
40 if (sample->state == EXTERNAL) ++external_sample_count_; 33 if (sample->state == EXTERNAL) ++external_sample_count_;
41 } 34 }
42 processor_->FinishTickSample(); 35 processor_->FinishTickSample();
43 } 36 }
44 37
45 private: 38 private:
46 ProfilerEventsProcessor* processor_; 39 ProfilerEventsProcessor* processor_;
47 }; 40 };
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; 374 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_;
382 Builtins::Name id = static_cast<Builtins::Name>(i); 375 Builtins::Name id = static_cast<Builtins::Name>(i);
383 rec->start = builtins->builtin(id)->address(); 376 rec->start = builtins->builtin(id)->address();
384 rec->builtin_id = id; 377 rec->builtin_id = id;
385 processor_->Enqueue(evt_rec); 378 processor_->Enqueue(evt_rec);
386 } 379 }
387 } 380 }
388 381
389 } // namespace internal 382 } // namespace internal
390 } // namespace v8 383 } // namespace v8
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/profiler/tick-sample.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698