Index: src/profiler/sampler.cc |
diff --git a/src/profiler/sampler.cc b/src/profiler/sampler.cc |
index 45f1d4d3efcfd726409b16ec2aa80f0b673b0d92..60397b6fc1c12b281a7604174ce04effe4b4b578 100644 |
--- a/src/profiler/sampler.cc |
+++ b/src/profiler/sampler.cc |
@@ -701,6 +701,11 @@ DISABLE_ASAN void TickSample::Init(Isolate* isolate, |
GetStackSample(isolate, regs, record_c_entry_frame, |
reinterpret_cast<void**>(&stack[0]), kMaxFramesCount, &info); |
frames_count = static_cast<unsigned>(info.frames_count); |
+ if (!frames_count) { |
+ // It is executing JS but failed to collect a stack trace. |
+ // Mark the sample as spoiled. |
+ pc = 0; |
+ } |
} |
@@ -797,7 +802,7 @@ void Sampler::SampleStack(const v8::RegisterState& state) { |
TickSample sample_obj; |
if (sample == NULL) sample = &sample_obj; |
sample->Init(isolate_, state, TickSample::kIncludeCEntryFrame, true); |
- if (is_counting_samples_) { |
+ if (is_counting_samples_ && sample->pc) { |
if (sample->state == JS) ++js_sample_count_; |
if (sample->state == EXTERNAL) ++external_sample_count_; |
} |