Index: src/profiler/cpu-profiler.cc |
diff --git a/src/profiler/cpu-profiler.cc b/src/profiler/cpu-profiler.cc |
index 439125a08d62b6216928c4a8a9951bdfccb4206c..b0416ec2e9b3494232760bcf6ff13cbecd2e8f3d 100644 |
--- a/src/profiler/cpu-profiler.cc |
+++ b/src/profiler/cpu-profiler.cc |
@@ -23,11 +23,18 @@ class CpuSampler : public sampler::Sampler { |
: sampler::Sampler(reinterpret_cast<v8::Isolate*>(isolate)), |
processor_(processor) {} |
- void SampleStack(const v8::RegisterState& regs) override { |
+ void SampleStack(const v8::RegisterState& state) override { |
+ v8::Isolate* v8_isolate = isolate(); |
+ Isolate* i_isolate = reinterpret_cast<Isolate*>(v8_isolate); |
+#if defined(USE_SIMULATOR) |
+ v8::RegisterState regs; |
+ if (!SimulatorHelper::FillRegisters(i_isolate, ®s)) return; |
+#else |
+ const v8::RegisterState& regs = state; |
+#endif |
TickSample* sample = processor_->StartTickSample(); |
- if (sample == nullptr) return; |
- Isolate* isolate = reinterpret_cast<Isolate*>(this->isolate()); |
- sample->Init(isolate, regs, TickSample::kIncludeCEntryFrame, true); |
+ if (sample == NULL) return; |
+ sample->Init(i_isolate, regs, TickSample::kIncludeCEntryFrame, true); |
if (is_counting_samples_ && !sample->timestamp.IsNull()) { |
if (sample->state == JS) ++js_sample_count_; |
if (sample->state == EXTERNAL) ++external_sample_count_; |