Chromium Code Reviews| Index: src/profile-generator.cc |
| diff --git a/src/profile-generator.cc b/src/profile-generator.cc |
| index d030b681ec669b1d7e99ed26751fd23e0899a59a..56cb8ab3f4eef4192057d488c8e0f26be1fdc4ad 100644 |
| --- a/src/profile-generator.cc |
| +++ b/src/profile-generator.cc |
| @@ -52,6 +52,7 @@ const char* const CodeEntry::kNoDeoptReason = ""; |
| CodeEntry::~CodeEntry() { |
| delete no_frame_ranges_; |
| delete line_info_; |
| + delete inlined_function_infos_; |
| } |
| @@ -112,8 +113,41 @@ void CodeEntry::FillFunctionInfo(SharedFunctionInfo* shared) { |
| } |
| +DeoptInfo CodeEntry::GetDeoptInfo() { |
| + DCHECK(has_deopt_info()); |
| + DCHECK(inlined_function_infos_); |
| + |
| + DeoptInfo info; |
| + info.deopt_reason = deopt_reason_; |
| + if (inlined_function_infos_->empty()) { |
| + info.AddInlineFrame(script_id_, position_ + deopt_position_.position()); |
|
alph
2015/03/18 18:15:18
Looks strange. Why do you want to add an inline fr
loislo
2015/03/19 08:16:12
For example in case of a debug breakpoint you will
|
| + return info; |
| + } |
| + // Copy the only branch from the inlining tree where the deopt happened. |
| + SourcePosition position = deopt_position_; |
| + int inlining_id = InlinedFunctionInfo::kNoParentId; |
| + for (size_t i = 0; i < inlined_function_infos_->size(); ++i) { |
| + InlinedFunctionInfo& current_info = inlined_function_infos_->at(i); |
| + if (std::binary_search(current_info.deopt_pc_offsets.begin(), |
| + current_info.deopt_pc_offsets.end(), pc_offset_)) { |
| + inlining_id = static_cast<int>(i); |
| + break; |
| + } |
| + } |
| + while (inlining_id != InlinedFunctionInfo::kNoParentId) { |
| + InlinedFunctionInfo& inlined_info = |
| + inlined_function_infos_->at(inlining_id); |
| + info.AddInlineFrame(inlined_info.script_id, |
| + inlined_info.start_position + position.raw()); |
| + position = inlined_info.inline_position; |
| + inlining_id = inlined_info.parent_id; |
| + } |
| + return info; |
| +} |
| + |
| + |
| void ProfileNode::CollectDeoptInfo(CodeEntry* entry) { |
| - deopt_infos_.Add(DeoptInfo(entry->deopt_reason(), entry->deopt_position())); |
| + deopt_infos_.push_back(entry->GetDeoptInfo()); |
| entry->clear_deopt_info(); |
| } |
| @@ -181,14 +215,16 @@ void ProfileNode::Print(int indent) { |
| if (entry_->resource_name()[0] != '\0') |
| base::OS::Print(" %s:%d", entry_->resource_name(), entry_->line_number()); |
| base::OS::Print("\n"); |
| - for (auto info : deopt_infos_) { |
| - if (FLAG_hydrogen_track_positions) { |
| - base::OS::Print("%*s deopted at %d_%d with reason '%s'\n", indent + 10, |
| - "", info.deopt_position.inlining_id(), |
| - info.deopt_position.position(), info.deopt_reason); |
| - } else { |
| - base::OS::Print("%*s deopted at %d with reason '%s'\n", indent + 10, "", |
| - info.deopt_position.raw(), info.deopt_reason); |
| + for (size_t i = 0; i < deopt_infos_.size(); ++i) { |
| + DeoptInfo& info = deopt_infos_[i]; |
| + base::OS::Print( |
| + "%*s;;; deopted at script_id: %d position: %d with reason '%s'.\n", |
| + indent + 10, "", info.stack[0].script_id, info.stack[0].position, |
| + info.deopt_reason); |
| + for (size_t i = 1; i < info.stack.size(); ++i) { |
| + base::OS::Print("%*s;;;%*s Inline point: script_id %d position: %d.\n", |
| + indent + 10, "", 4, "", info.stack[i].script_id, |
|
alph
2015/03/18 18:15:18
4, ""
why?
loislo
2015/03/19 08:16:12
it is an indent for inlined function stack entries
|
| + info.stack[i].position); |
| } |
| } |
| const char* bailout_reason = entry_->bailout_reason(); |