| 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/ast/scopeinfo.h" | 7 #include "src/ast/scopeinfo.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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 CpuProfileDeoptInfo info; | 132 CpuProfileDeoptInfo info; |
| 133 info.deopt_reason = deopt_reason_; | 133 info.deopt_reason = deopt_reason_; |
| 134 if (inlined_function_infos_.empty()) { | 134 if (inlined_function_infos_.empty()) { |
| 135 info.stack.push_back(CpuProfileDeoptFrame( | 135 info.stack.push_back(CpuProfileDeoptFrame( |
| 136 {script_id_, position_ + deopt_position_.position()})); | 136 {script_id_, position_ + deopt_position_.position()})); |
| 137 return info; | 137 return info; |
| 138 } | 138 } |
| 139 // Copy the only branch from the inlining tree where the deopt happened. | 139 // Copy the only branch from the inlining tree where the deopt happened. |
| 140 SourcePosition position = deopt_position_; | 140 SourcePosition position = deopt_position_; |
| 141 int inlining_id = InlinedFunctionInfo::kNoParentId; | 141 int inlining_id = deopt_inlining_id_; |
| 142 for (size_t i = 0; i < inlined_function_infos_.size(); ++i) { | |
| 143 InlinedFunctionInfo& current_info = inlined_function_infos_.at(i); | |
| 144 if (std::binary_search(current_info.deopt_pc_offsets.begin(), | |
| 145 current_info.deopt_pc_offsets.end(), pc_offset_)) { | |
| 146 inlining_id = static_cast<int>(i); | |
| 147 break; | |
| 148 } | |
| 149 } | |
| 150 while (inlining_id != InlinedFunctionInfo::kNoParentId) { | 142 while (inlining_id != InlinedFunctionInfo::kNoParentId) { |
| 151 InlinedFunctionInfo& inlined_info = inlined_function_infos_.at(inlining_id); | 143 InlinedFunctionInfo& inlined_info = inlined_function_infos_.at(inlining_id); |
| 152 info.stack.push_back( | 144 info.stack.push_back( |
| 153 CpuProfileDeoptFrame({inlined_info.script_id, | 145 CpuProfileDeoptFrame({inlined_info.script_id, |
| 154 inlined_info.start_position + position.raw()})); | 146 inlined_info.start_position + position.raw()})); |
| 155 position = inlined_info.inline_position; | 147 position = inlined_info.inline_position; |
| 156 inlining_id = inlined_info.parent_id; | 148 inlining_id = inlined_info.parent_id; |
| 157 } | 149 } |
| 158 return info; | 150 return info; |
| 159 } | 151 } |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 case EXTERNAL: | 702 case EXTERNAL: |
| 711 return program_entry_; | 703 return program_entry_; |
| 712 case IDLE: | 704 case IDLE: |
| 713 return idle_entry_; | 705 return idle_entry_; |
| 714 default: return NULL; | 706 default: return NULL; |
| 715 } | 707 } |
| 716 } | 708 } |
| 717 | 709 |
| 718 } // namespace internal | 710 } // namespace internal |
| 719 } // namespace v8 | 711 } // namespace v8 |
| OLD | NEW |