Chromium Code Reviews

Unified Diff: src/profiler/profile-generator.cc

Issue 2503393002: [cpu-profiler] use new source position information for deoptimization in cpu profiler (Closed)
Patch Set: removed CodeDeoptEvent::position Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/profiler/profile-generator.cc
diff --git a/src/profiler/profile-generator.cc b/src/profiler/profile-generator.cc
index a4da7cae7f320400aa366a5084c497674ee45e35..edb3b9feb7fa3b8c7e33d712ed0045f27f92b343 100644
--- a/src/profiler/profile-generator.cc
+++ b/src/profiler/profile-generator.cc
@@ -155,11 +155,11 @@ const std::vector<CodeEntry*>* CodeEntry::GetInlineStack(int pc_offset) const {
}
void CodeEntry::AddDeoptInlinedFrames(
- int deopt_id, std::vector<DeoptInlinedFrame>& inlined_frames) {
+ int deopt_id, std::vector<CpuProfileDeoptFrame>& inlined_frames) {
// It's better to use std::move to place the vector into the map,
// but it's not supported by the current stdlibc++ on MacOS.
deopt_inlined_frames_
- .insert(std::make_pair(deopt_id, std::vector<DeoptInlinedFrame>()))
+ .insert(std::make_pair(deopt_id, std::vector<CpuProfileDeoptFrame>()))
alph 2016/11/17 00:09:43 I believe it's now ok to use std::move Could you p
.first->second.swap(inlined_frames);
}
@@ -181,19 +181,10 @@ CpuProfileDeoptInfo CodeEntry::GetDeoptInfo() {
CpuProfileDeoptInfo info;
info.deopt_reason = deopt_reason_;
DCHECK_NE(kNoDeoptimizationId, deopt_id_);
- size_t position = static_cast<size_t>(deopt_position_.ScriptOffset());
if (deopt_inlined_frames_.find(deopt_id_) == deopt_inlined_frames_.end()) {
- info.stack.push_back(CpuProfileDeoptFrame({script_id_, position}));
+ info.stack.push_back(CpuProfileDeoptFrame({script_id_, position()}));
} else {
- // Copy stack of inlined frames where the deopt happened.
- std::vector<DeoptInlinedFrame>& frames = deopt_inlined_frames_[deopt_id_];
- bool first = true;
- for (DeoptInlinedFrame& inlined_frame : base::Reversed(frames)) {
- info.stack.push_back(
- CpuProfileDeoptFrame({inlined_frame.script_id,
- first ? position : inlined_frame.position}));
- first = false; // Done with innermost frame.
- }
+ info.stack = deopt_inlined_frames_[deopt_id_];
}
return info;
}

Powered by Google App Engine