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

Unified Diff: src/profiler/tick-sample.cc

Issue 2151103002: [cpu-profiler] Do not record empty stack trace. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/tick-sample.cc
diff --git a/src/profiler/tick-sample.cc b/src/profiler/tick-sample.cc
index 8b7fe2c73ac6aceb20a324925a1331042a0f727b..533f34f85216f2ffaa8241d6b2dd071b4f48e434 100644
--- a/src/profiler/tick-sample.cc
+++ b/src/profiler/tick-sample.cc
@@ -145,28 +145,33 @@ 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 interpreted frames use the bytecode array pointer as the pc.
- 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 =
- reinterpret_cast<i::Address>(frame->GetBytecodeArray()) -
- i::kHeapObjectTag;
- frames[i++] = bytecode_array + i::BytecodeArray::kHeaderSize +
- frame->GetBytecodeOffset();
- } else {
+ for (; !it.done() && i < frames_limit; it.Advance()) {
+ if (!it.frame()->is_interpreted()) {
frames[i++] = it.frame()->pc();
+ continue;
}
- it.Advance();
+ // For interpreted frames use the bytecode array pointer as the pc.
+ 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 =
+ reinterpret_cast<i::Address>(frame->GetBytecodeArray()) -
+ i::kHeapObjectTag;
+ frames[i++] = bytecode_array + i::BytecodeArray::kHeaderSize +
+ frame->GetBytecodeOffset();
}
sample_info->frames_count = i;
return true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698