Chromium Code Reviews| Index: runtime/vm/stack_frame.cc |
| =================================================================== |
| --- runtime/vm/stack_frame.cc (revision 17826) |
| +++ runtime/vm/stack_frame.cc (working copy) |
| @@ -280,32 +280,50 @@ |
| } |
| -InlinedFunctionsInDartFrameIterator::InlinedFunctionsInDartFrameIterator( |
| - StackFrame* frame) : index_(0), |
| - deopt_instructions_(), |
| - object_table_(Array::Handle()) { |
| +InlinedFunctionsIterator::InlinedFunctionsIterator(StackFrame* frame) |
| + : index_(0), |
| + code_(Code::Handle()), |
| + deopt_info_(DeoptInfo::Handle()), |
| + function_(Function::Handle()), |
| + pc_(0), |
| + deopt_instructions_(), |
| + object_table_(Array::Handle()) { |
| ASSERT(frame != NULL); |
| - const Code& code = Code::Handle(frame->LookupDartCode()); |
| - ASSERT(code.is_optimized()); |
| + code_ = frame->LookupDartCode(); |
| + ASSERT(code_.is_optimized()); |
| intptr_t deopt_reason = kDeoptUnknown; |
| - const DeoptInfo& deopt_info = DeoptInfo::Handle( |
| - code.GetDeoptInfoAtPc(frame->pc(), &deopt_reason)); |
| - ASSERT(!deopt_info.IsNull()); |
| - |
| - // Unpack deopt info into instructions (translate away suffixes). |
| - const Array& deopt_table = Array::Handle(code.deopt_info_array()); |
| - ASSERT(!deopt_table.IsNull()); |
| - deopt_info.ToInstructions(deopt_table, &deopt_instructions_); |
| - |
| - object_table_ = code.object_table(); |
| + deopt_info_ = code_.GetDeoptInfoAtPc(frame->pc(), &deopt_reason); |
| + if (deopt_info_.IsNull()) { |
| + // This is the case when a call without deopt info in optimzed code |
| + // throws an exception. (e.g. in the parameter copying prologue). |
| + // In that case there won't be any inlined frames. |
|
Vyacheslav Egorov (Google)
2013/01/30 13:03:11
Can we verify that this is indeed a prologue that
Florian Schneider
2013/01/30 14:11:16
In the failing tests it is. But that does not excl
|
| + function_ = code_.function(); |
| + pc_ = frame->pc(); |
| + ASSERT(pc_ != 0); |
| + } else { |
| + // Unpack deopt info into instructions (translate away suffixes). |
| + const Array& deopt_table = Array::Handle(code_.deopt_info_array()); |
| + ASSERT(!deopt_table.IsNull()); |
| + deopt_info_.ToInstructions(deopt_table, &deopt_instructions_); |
| + object_table_ = code_.object_table(); |
| + } |
| } |
| -RawFunction* InlinedFunctionsInDartFrameIterator::GetNextFunction(uword* pc) { |
| +RawFunction* InlinedFunctionsIterator::GetNextFunctionAndCode(uword* pc, |
|
Vyacheslav Egorov (Google)
2013/01/30 13:03:11
Instead of having three return values you can refa
Florian Schneider
2013/01/30 14:06:43
Done.
|
| + Code* code) { |
| if (index_ == -1) { |
| return Function::null(); |
| } |
| + if (deopt_info_.IsNull()) { |
| + // No deoptimization info. Return the optimized code and pc. |
| + index_ = -1; |
| + *pc = pc_; |
| + *code = code_.raw(); |
| + return function_.raw(); |
| + } |
| + |
| // Iterate over the deopt instructions and determine the inlined |
| // functions if any and iterate over them. |
| Function& func = Function::Handle(); |
| @@ -317,6 +335,7 @@ |
| *pc = DeoptInstr::GetRetAfterAddress(deopt_instr, |
| object_table_, |
| &func); |
| + *code = func.unoptimized_code(); |
| return func.raw(); |
| } |
| } |