| Index: runtime/vm/stack_frame.cc
|
| ===================================================================
|
| --- runtime/vm/stack_frame.cc (revision 16999)
|
| +++ runtime/vm/stack_frame.cc (working copy)
|
| @@ -5,6 +5,7 @@
|
| #include "vm/stack_frame.h"
|
|
|
| #include "vm/assembler_macros.h"
|
| +#include "vm/deopt_instructions.h"
|
| #include "vm/isolate.h"
|
| #include "vm/object.h"
|
| #include "vm/object_store.h"
|
| @@ -288,4 +289,52 @@
|
| return &entry_;
|
| }
|
|
|
| +
|
| +InlinedFunctionsInDartFrameIterator::InlinedFunctionsInDartFrameIterator(
|
| + StackFrame* frame) : index_(0),
|
| + frame_(frame),
|
| + func_(Function::Handle()),
|
| + deopt_info_(DeoptInfo::Handle()),
|
| + object_table_(Array::Handle()) {
|
| + ASSERT(frame_ != NULL);
|
| + const Code& code = Code::Handle(frame_->LookupDartCode());
|
| + ASSERT(code.is_optimized());
|
| + func_ = code.function();
|
| + intptr_t deopt_reason = kDeoptUnknown;
|
| + deopt_info_ = code.GetDeoptInfoAtPc(frame_->pc(), &deopt_reason);
|
| + object_table_ = code.object_table();
|
| +}
|
| +
|
| +
|
| +RawFunction* InlinedFunctionsInDartFrameIterator::GetNextFunction(uword* pc) {
|
| + if (index_ == -1) {
|
| + return Function::null();
|
| + }
|
| + if (deopt_info_.IsNull()) {
|
| + // We are at a PC that has no deoptimization info so there are no
|
| + // inlined functions to iterate over, we return the function.
|
| + index_ = -1; // No more functions.
|
| + *pc = frame_->pc();
|
| + return func_.raw();
|
| + }
|
| + // Iterate over the deopt instructions and determine the inlined
|
| + // functions if any and iterate over them.
|
| + ASSERT(deopt_info_.Length() != 0);
|
| + while (index_ < deopt_info_.Length()) {
|
| + intptr_t cur_index = index_;
|
| + index_ += 1;
|
| + intptr_t deopt_instr = deopt_info_.Instruction(cur_index);
|
| + ASSERT(deopt_instr != DeoptInstr::kRetBeforeAddress);
|
| + if ((deopt_instr == DeoptInstr::kRetAfterAddress)) {
|
| + intptr_t deopt_from_index = deopt_info_.FromIndex(cur_index);
|
| + *pc = DeoptInstr::GetRetAfterAddress(deopt_from_index,
|
| + object_table_,
|
| + &func_);
|
| + return func_.raw();
|
| + }
|
| + }
|
| + index_ = -1;
|
| + return Function::null();
|
| +}
|
| +
|
| } // namespace dart
|
|
|