Commit 7e1d1fc7 authored by alph's avatar alph Committed by Commit bot

[cpu-profiler] Do not record empty stack trace.

When it is in executing JS state there should be a JS stack.
Having no stack means something is wrong with frame pointer, so
just skip the bogus sample.

Review-Url: https://codereview.chromium.org/2151103002
Cr-Commit-Position: refs/heads/master@{#37802}
parent e6b3002a
......@@ -145,17 +145,26 @@ bool TickSample::GetStackSample(Isolate* v8_isolate, const RegisterState& regs,
i::SafeStackFrameIterator it(isolate, reinterpret_cast<i::Address>(regs.fp),
reinterpret_cast<i::Address>(regs.sp),
js_entry_sp);
// If at this point iterator does not see any frames,
// is usually means something is wrong with the FP,
// e.g. it is used as a general purpose register in the function.
// Bailout.
if (it.done()) return false;
size_t i = 0;
if (record_c_entry_frame == kIncludeCEntryFrame && !it.done() &&
if (record_c_entry_frame == kIncludeCEntryFrame &&
(it.top_frame_type() == internal::StackFrame::EXIT ||
it.top_frame_type() == internal::StackFrame::BUILTIN_EXIT)) {
frames[i++] = isolate->c_function();
}
while (!it.done() && i < frames_limit) {
if (it.frame()->is_interpreted()) {
for (; !it.done() && i < frames_limit; it.Advance()) {
if (!it.frame()->is_interpreted()) {
frames[i++] = it.frame()->pc();
continue;
}
// For interpreted frames use the bytecode array pointer as the pc.
i::InterpretedFrame* frame =
static_cast<i::InterpretedFrame*>(it.frame());
i::InterpretedFrame* frame = static_cast<i::InterpretedFrame*>(it.frame());
// Since the sampler can interrupt execution at any point the
// bytecode_array might be garbage, so don't dereference it.
i::Address bytecode_array =
......@@ -163,10 +172,6 @@ bool TickSample::GetStackSample(Isolate* v8_isolate, const RegisterState& regs,
i::kHeapObjectTag;
frames[i++] = bytecode_array + i::BytecodeArray::kHeaderSize +
frame->GetBytecodeOffset();
} else {
frames[i++] = it.frame()->pc();
}
it.Advance();
}
sample_info->frames_count = i;
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment