Commit eed9b039 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cpu-profiler] Remove ProfileStackTrace

We used to have extra data in this but now it's just an indirection to
CodeEntryAndLineNumber so use that everywhere instead.

Change-Id: I6dcedabc1502bc1eed25c05e23f04b996b91bae7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2440829
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70294}
parent 53828de9
......@@ -403,11 +403,11 @@ ProfileNode* ProfileTree::AddPathFromEnd(const ProfileStackTrace& path,
CodeEntry* last_entry = nullptr;
int parent_line_number = v8::CpuProfileNode::kNoLineNumberInfo;
for (auto it = path.rbegin(); it != path.rend(); ++it) {
if (it->entry.code_entry == nullptr) continue;
last_entry = (*it).entry.code_entry;
node = node->FindOrAddChild((*it).entry.code_entry, parent_line_number);
if (it->code_entry == nullptr) continue;
last_entry = it->code_entry;
node = node->FindOrAddChild(it->code_entry, parent_line_number);
parent_line_number = mode == ProfilingMode::kCallerLineNumbers
? (*it).entry.line_number
? it->line_number
: v8::CpuProfileNode::kNoLineNumberInfo;
}
if (last_entry && last_entry->has_deopt_info()) {
......
......@@ -228,11 +228,7 @@ struct CodeEntryAndLineNumber {
int line_number;
};
struct ProfileStackFrame {
CodeEntryAndLineNumber entry;
};
typedef std::vector<ProfileStackFrame> ProfileStackTrace;
using ProfileStackTrace = std::vector<CodeEntryAndLineNumber>;
class ProfileTree;
......
......@@ -66,9 +66,9 @@ Symbolizer::SymbolizedSample Symbolizer::SymbolizeTickSample(
// Don't use PC when in external callback code, as it can point
// inside a callback's code, and we will erroneously report
// that a callback calls itself.
stack_trace.push_back({{FindEntry(reinterpret_cast<Address>(
sample.external_callback_entry)),
no_line_info}});
stack_trace.push_back(
{FindEntry(reinterpret_cast<Address>(sample.external_callback_entry)),
no_line_info});
} else {
Address attributed_pc = reinterpret_cast<Address>(sample.pc);
Address pc_entry_instruction_start = kNullAddress;
......@@ -94,7 +94,7 @@ Symbolizer::SymbolizedSample Symbolizer::SymbolizeTickSample(
src_line = pc_entry->line_number();
}
src_line_not_found = false;
stack_trace.push_back({{pc_entry, src_line}});
stack_trace.push_back({pc_entry, src_line});
if (pc_entry->builtin_id() == Builtins::kFunctionPrototypeApply ||
pc_entry->builtin_id() == Builtins::kFunctionPrototypeCall) {
......@@ -108,7 +108,7 @@ Symbolizer::SymbolizedSample Symbolizer::SymbolizeTickSample(
ProfilerStats::Instance()->AddReason(
ProfilerStats::Reason::kInCallOrApply);
stack_trace.push_back(
{{CodeEntry::unresolved_entry(), no_line_info}});
{CodeEntry::unresolved_entry(), no_line_info});
}
}
}
......@@ -128,7 +128,7 @@ Symbolizer::SymbolizedSample Symbolizer::SymbolizeTickSample(
if (inline_stack) {
int most_inlined_frame_line_number = entry->GetSourceLine(pc_offset);
for (auto entry : *inline_stack) {
stack_trace.push_back({entry});
stack_trace.push_back(entry);
}
// This is a bit of a messy hack. The line number for the most-inlined
......@@ -140,7 +140,7 @@ Symbolizer::SymbolizedSample Symbolizer::SymbolizeTickSample(
// inlining_id.
DCHECK(!inline_stack->empty());
size_t index = stack_trace.size() - inline_stack->size();
stack_trace[index].entry.line_number = most_inlined_frame_line_number;
stack_trace[index].line_number = most_inlined_frame_line_number;
}
// Skip unresolved frames (e.g. internal frame) and get source line of
// the first JS caller.
......@@ -159,14 +159,14 @@ Symbolizer::SymbolizedSample Symbolizer::SymbolizeTickSample(
// so we use it instead of pushing entry to stack_trace.
if (inline_stack) continue;
}
stack_trace.push_back({{entry, line_number}});
stack_trace.push_back({entry, line_number});
}
}
if (FLAG_prof_browser_mode) {
bool no_symbolized_entries = true;
for (auto e : stack_trace) {
if (e.entry.code_entry != nullptr) {
if (e.code_entry != nullptr) {
no_symbolized_entries = false;
break;
}
......@@ -179,7 +179,7 @@ Symbolizer::SymbolizedSample Symbolizer::SymbolizeTickSample(
ProfilerStats::Instance()->AddReason(
ProfilerStats::Reason::kNoSymbolizedFrames);
}
stack_trace.push_back({{EntryForVMState(sample.state), no_line_info}});
stack_trace.push_back({EntryForVMState(sample.state), no_line_info});
}
}
......
......@@ -201,7 +201,7 @@ TEST(ProfileTreeAddPathFromEndWithLineNumbers) {
ProfileTree tree(CcTest::i_isolate());
ProfileTreeTestHelper helper(&tree);
ProfileStackTrace path = {{{&c, 5}}, {{&b, 3}}, {{&a, 1}}};
ProfileStackTrace path = {{&c, 5}, {&b, 3}, {&a, 1}};
tree.AddPathFromEnd(path, v8::CpuProfileNode::kNoLineNumberInfo, true,
v8::CpuProfilingMode::kCallerLineNumbers);
......@@ -399,8 +399,8 @@ TEST(SymbolizeTickSample) {
symbolizer.SymbolizeTickSample(sample1);
ProfileStackTrace& stack_trace = symbolized.stack_trace;
CHECK_EQ(2, stack_trace.size());
CHECK_EQ(entry1, stack_trace[0].entry.code_entry);
CHECK_EQ(entry1, stack_trace[1].entry.code_entry);
CHECK_EQ(entry1, stack_trace[0].code_entry);
CHECK_EQ(entry1, stack_trace[1].code_entry);
TickSample sample2;
sample2.pc = ToPointer(0x1925);
......@@ -412,10 +412,10 @@ TEST(SymbolizeTickSample) {
symbolized = symbolizer.SymbolizeTickSample(sample2);
stack_trace = symbolized.stack_trace;
CHECK_EQ(4, stack_trace.size());
CHECK_EQ(entry3, stack_trace[0].entry.code_entry);
CHECK_EQ(entry2, stack_trace[1].entry.code_entry);
CHECK_EQ(nullptr, stack_trace[2].entry.code_entry);
CHECK_EQ(entry1, stack_trace[3].entry.code_entry);
CHECK_EQ(entry3, stack_trace[0].code_entry);
CHECK_EQ(entry2, stack_trace[1].code_entry);
CHECK_EQ(nullptr, stack_trace[2].code_entry);
CHECK_EQ(entry1, stack_trace[3].code_entry);
TickSample sample3;
sample3.pc = ToPointer(0x1510);
......@@ -426,9 +426,9 @@ TEST(SymbolizeTickSample) {
symbolized = symbolizer.SymbolizeTickSample(sample3);
stack_trace = symbolized.stack_trace;
CHECK_EQ(3, stack_trace.size());
CHECK_EQ(entry1, stack_trace[0].entry.code_entry);
CHECK_EQ(entry3, stack_trace[1].entry.code_entry);
CHECK_EQ(entry1, stack_trace[2].entry.code_entry);
CHECK_EQ(entry1, stack_trace[0].code_entry);
CHECK_EQ(entry3, stack_trace[1].code_entry);
CHECK_EQ(entry1, stack_trace[2].code_entry);
}
static void CheckNodeIds(const ProfileNode* node, unsigned* expectedId) {
......
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