| OLD | NEW |
| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (deopt_inlined_frames_.find(deopt_id_) == deopt_inlined_frames_.end()) { | 184 if (deopt_inlined_frames_.find(deopt_id_) == deopt_inlined_frames_.end()) { |
| 185 info.stack.push_back(CpuProfileDeoptFrame( | 185 info.stack.push_back( |
| 186 {script_id_, position_ + deopt_position_.position()})); | 186 CpuProfileDeoptFrame({script_id_, deopt_position_.ScriptOffset()})); |
| 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(CpuProfileDeoptFrame( |
| 193 {inlined_frame.script_id, deopt_position + inlined_frame.position})); | 193 {inlined_frame.script_id, |
| 194 deopt_position = 0; // Done with innermost frame. | 194 first ? deopt_position_.ScriptOffset() : 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 Loading... |
| 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 |
| OLD | NEW |