| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/profile-generator-inl.h" | 7 #include "src/profile-generator-inl.h" |
| 8 | 8 |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/debug.h" | 10 #include "src/debug.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 | 113 |
| 114 | 114 |
| 115 DeoptInfo CodeEntry::GetDeoptInfo() { | 115 DeoptInfo CodeEntry::GetDeoptInfo() { |
| 116 DCHECK(has_deopt_info()); | 116 DCHECK(has_deopt_info()); |
| 117 | 117 |
| 118 DeoptInfo info; | 118 DeoptInfo info; |
| 119 info.deopt_reason = deopt_reason_; | 119 info.deopt_reason = deopt_reason_; |
| 120 if (inlined_function_infos_.empty()) { | 120 if (inlined_function_infos_.empty()) { |
| 121 info.stack.push_back(DeoptInfo::Frame( | 121 info.stack.push_back(DeoptInfo::Frame( |
| 122 {script_id_, | 122 {script_id_, position_ + deopt_position_.position()})); |
| 123 static_cast<int>(position_ + deopt_position_.position())})); | |
| 124 return info; | 123 return info; |
| 125 } | 124 } |
| 126 // Copy the only branch from the inlining tree where the deopt happened. | 125 // Copy the only branch from the inlining tree where the deopt happened. |
| 127 SourcePosition position = deopt_position_; | 126 SourcePosition position = deopt_position_; |
| 128 int inlining_id = InlinedFunctionInfo::kNoParentId; | 127 int inlining_id = InlinedFunctionInfo::kNoParentId; |
| 129 for (size_t i = 0; i < inlined_function_infos_.size(); ++i) { | 128 for (size_t i = 0; i < inlined_function_infos_.size(); ++i) { |
| 130 InlinedFunctionInfo& current_info = inlined_function_infos_.at(i); | 129 InlinedFunctionInfo& current_info = inlined_function_infos_.at(i); |
| 131 if (std::binary_search(current_info.deopt_pc_offsets.begin(), | 130 if (std::binary_search(current_info.deopt_pc_offsets.begin(), |
| 132 current_info.deopt_pc_offsets.end(), pc_offset_)) { | 131 current_info.deopt_pc_offsets.end(), pc_offset_)) { |
| 133 inlining_id = static_cast<int>(i); | 132 inlining_id = static_cast<int>(i); |
| 134 break; | 133 break; |
| 135 } | 134 } |
| 136 } | 135 } |
| 137 while (inlining_id != InlinedFunctionInfo::kNoParentId) { | 136 while (inlining_id != InlinedFunctionInfo::kNoParentId) { |
| 138 InlinedFunctionInfo& inlined_info = inlined_function_infos_.at(inlining_id); | 137 InlinedFunctionInfo& inlined_info = inlined_function_infos_.at(inlining_id); |
| 139 info.stack.push_back(DeoptInfo::Frame( | 138 info.stack.push_back(DeoptInfo::Frame( |
| 140 {inlined_info.script_id, | 139 {inlined_info.script_id, |
| 141 static_cast<int>(inlined_info.start_position + position.raw())})); | 140 inlined_info.start_position + position.raw()})); |
| 142 position = inlined_info.inline_position; | 141 position = inlined_info.inline_position; |
| 143 inlining_id = inlined_info.parent_id; | 142 inlining_id = inlined_info.parent_id; |
| 144 } | 143 } |
| 145 return info; | 144 return info; |
| 146 } | 145 } |
| 147 | 146 |
| 148 | 147 |
| 149 void ProfileNode::CollectDeoptInfo(CodeEntry* entry) { | 148 void ProfileNode::CollectDeoptInfo(CodeEntry* entry) { |
| 150 deopt_infos_.push_back(entry->GetDeoptInfo()); | 149 deopt_infos_.push_back(entry->GetDeoptInfo()); |
| 151 entry->clear_deopt_info(); | 150 entry->clear_deopt_info(); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 case OTHER: | 691 case OTHER: |
| 693 case EXTERNAL: | 692 case EXTERNAL: |
| 694 return program_entry_; | 693 return program_entry_; |
| 695 case IDLE: | 694 case IDLE: |
| 696 return idle_entry_; | 695 return idle_entry_; |
| 697 default: return NULL; | 696 default: return NULL; |
| 698 } | 697 } |
| 699 } | 698 } |
| 700 | 699 |
| 701 } } // namespace v8::internal | 700 } } // namespace v8::internal |
| OLD | NEW |