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

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

Issue 2559743002: Merged: [cpu-profiler] use new source position information for deoptimization in cpu profiler (Closed)
Patch Set: addressed comment Created 4 years 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 | « src/profiler/profile-generator.h ('k') | src/profiler/profile-generator-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/profile-generator.cc
diff --git a/src/profiler/profile-generator.cc b/src/profiler/profile-generator.cc
index a4da7cae7f320400aa366a5084c497674ee45e35..b647670b59a33a090d9f959a725f45fb532caa64 100644
--- a/src/profiler/profile-generator.cc
+++ b/src/profiler/profile-generator.cc
@@ -142,11 +142,8 @@ int CodeEntry::GetSourceLine(int pc_offset) const {
}
void CodeEntry::AddInlineStack(int pc_offset,
- std::vector<CodeEntry*>& inline_stack) {
- // 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.
- inline_locations_.insert(std::make_pair(pc_offset, std::vector<CodeEntry*>()))
- .first->second.swap(inline_stack);
+ std::vector<CodeEntry*> inline_stack) {
+ inline_locations_.insert(std::make_pair(pc_offset, std::move(inline_stack)));
}
const std::vector<CodeEntry*>* CodeEntry::GetInlineStack(int pc_offset) const {
@@ -155,12 +152,9 @@ const std::vector<CodeEntry*>* CodeEntry::GetInlineStack(int pc_offset) const {
}
void CodeEntry::AddDeoptInlinedFrames(
- int deopt_id, std::vector<DeoptInlinedFrame>& 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>()))
- .first->second.swap(inlined_frames);
+ int deopt_id, std::vector<CpuProfileDeoptFrame> inlined_frames) {
+ deopt_inlined_frames_.insert(
+ std::make_pair(deopt_id, std::move(inlined_frames)));
}
bool CodeEntry::HasDeoptInlinedFramesFor(int deopt_id) const {
@@ -181,19 +175,11 @@ 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_, static_cast<size_t>(std::max(0, 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;
}
« no previous file with comments | « src/profiler/profile-generator.h ('k') | src/profiler/profile-generator-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698