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

Side by Side Diff: src/profiler/profile-generator.cc

Issue 2451853002: Uniform and precise source positions for inlining (Closed)
Patch Set: fixed gcmole issue Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/profiler/profile-generator.h" 5 #include "src/profiler/profile-generator.h"
6 6
7 #include "src/base/adapters.h" 7 #include "src/base/adapters.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/global-handles.h" 10 #include "src/global-handles.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 set_position(shared->start_position()); 174 set_position(shared->start_position());
175 set_bailout_reason(GetBailoutReason(shared->disable_optimization_reason())); 175 set_bailout_reason(GetBailoutReason(shared->disable_optimization_reason()));
176 } 176 }
177 177
178 CpuProfileDeoptInfo CodeEntry::GetDeoptInfo() { 178 CpuProfileDeoptInfo CodeEntry::GetDeoptInfo() {
179 DCHECK(has_deopt_info()); 179 DCHECK(has_deopt_info());
180 180
181 CpuProfileDeoptInfo info; 181 CpuProfileDeoptInfo info;
182 info.deopt_reason = deopt_reason_; 182 info.deopt_reason = deopt_reason_;
183 DCHECK_NE(kNoDeoptimizationId, deopt_id_); 183 DCHECK_NE(kNoDeoptimizationId, deopt_id_);
184 size_t position = static_cast<size_t>(deopt_position_.ScriptOffset());
184 if (deopt_inlined_frames_.find(deopt_id_) == deopt_inlined_frames_.end()) { 185 if (deopt_inlined_frames_.find(deopt_id_) == deopt_inlined_frames_.end()) {
185 info.stack.push_back(CpuProfileDeoptFrame( 186 info.stack.push_back(CpuProfileDeoptFrame({script_id_, position}));
186 {script_id_, position_ + deopt_position_.position()}));
187 } else { 187 } else {
188 size_t deopt_position = deopt_position_.raw();
189 // Copy stack of inlined frames where the deopt happened. 188 // Copy stack of inlined frames where the deopt happened.
190 std::vector<DeoptInlinedFrame>& frames = deopt_inlined_frames_[deopt_id_]; 189 std::vector<DeoptInlinedFrame>& frames = deopt_inlined_frames_[deopt_id_];
190 bool first = true;
191 for (DeoptInlinedFrame& inlined_frame : base::Reversed(frames)) { 191 for (DeoptInlinedFrame& inlined_frame : base::Reversed(frames)) {
192 info.stack.push_back(CpuProfileDeoptFrame( 192 info.stack.push_back(
193 {inlined_frame.script_id, deopt_position + inlined_frame.position})); 193 CpuProfileDeoptFrame({inlined_frame.script_id,
194 deopt_position = 0; // Done with innermost frame. 194 first ? position : inlined_frame.position}));
195 first = false; // Done with innermost frame.
195 } 196 }
196 } 197 }
197 return info; 198 return info;
198 } 199 }
199 200
200 201
201 void ProfileNode::CollectDeoptInfo(CodeEntry* entry) { 202 void ProfileNode::CollectDeoptInfo(CodeEntry* entry) {
202 deopt_infos_.push_back(entry->GetDeoptInfo()); 203 deopt_infos_.push_back(entry->GetDeoptInfo());
203 entry->clear_deopt_info(); 204 entry->clear_deopt_info();
204 } 205 }
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 case EXTERNAL: 785 case EXTERNAL:
785 return CodeEntry::program_entry(); 786 return CodeEntry::program_entry();
786 case IDLE: 787 case IDLE:
787 return CodeEntry::idle_entry(); 788 return CodeEntry::idle_entry();
788 default: return NULL; 789 default: return NULL;
789 } 790 }
790 } 791 }
791 792
792 } // namespace internal 793 } // namespace internal
793 } // namespace v8 794 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698