Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::InlinedFunctionsIterator Class Reference

#include <stack_frame.h>

Inheritance diagram for dart::InlinedFunctionsIterator:
dart::ValueObject

Public Member Functions

 InlinedFunctionsIterator (const Code &code, uword pc)
 
bool Done () const
 
void Advance ()
 
FunctionPtr function () const
 
uword pc () const
 
CodePtr code () const
 
intptr_t GetDeoptFpOffset () const
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 367 of file stack_frame.h.

Constructor & Destructor Documentation

◆ InlinedFunctionsIterator()

dart::InlinedFunctionsIterator::InlinedFunctionsIterator ( const Code code,
uword  pc 
)

Definition at line 663 of file stack_frame.cc.

664 : index_(0),
665 num_materializations_(0),
666 dest_frame_size_(0),
667 code_(Code::Handle(code.ptr())),
668 deopt_info_(TypedData::Handle()),
669 function_(Function::Handle()),
670 pc_(pc),
671 deopt_instructions_(),
672 object_table_(ObjectPool::Handle()) {
673 ASSERT(code_.is_optimized());
674 ASSERT(pc_ != 0);
675 ASSERT(code.ContainsInstructionAt(pc));
676#if defined(DART_PRECOMPILED_RUNTIME)
677 ASSERT(deopt_info_.IsNull());
678 function_ = code_.function();
679#else
680 ICData::DeoptReasonId deopt_reason = ICData::kDeoptUnknown;
681 uint32_t deopt_flags = 0;
682 deopt_info_ = code_.GetDeoptInfoAtPc(pc, &deopt_reason, &deopt_flags);
683 if (deopt_info_.IsNull()) {
684 // This is the case when a call without deopt info in optimized code
685 // throws an exception. (e.g. in the parameter copying prologue).
686 // In that case there won't be any inlined frames.
687 function_ = code_.function();
688 } else {
689 // Unpack deopt info into instructions (translate away suffixes).
690 const Array& deopt_table = Array::Handle(code_.deopt_info_array());
691 ASSERT(!deopt_table.IsNull());
692 DeoptInfo::Unpack(deopt_table, deopt_info_, &deopt_instructions_);
693 num_materializations_ = DeoptInfo::NumMaterializations(deopt_instructions_);
694 dest_frame_size_ = DeoptInfo::FrameSize(deopt_info_);
695 object_table_ = code_.GetObjectPool();
696 Advance();
697 }
698#endif // defined(DART_PRECOMPILED_RUNTIME)
699}
FunctionPtr function() const
Definition object.h:7101
ArrayPtr deopt_info_array() const
Definition object.h:6916
bool is_optimized() const
Definition object.h:6790
ObjectPoolPtr GetObjectPool() const
Definition object.cc:17773
TypedDataPtr GetDeoptInfoAtPc(uword pc, ICData::DeoptReasonId *deopt_reason, uint32_t *deopt_flags) const
Definition object.cc:17790
static intptr_t NumMaterializations(const GrowableArray< DeoptInstr * > &)
static void Unpack(const Array &table, const TypedData &packed, GrowableArray< DeoptInstr * > *instructions)
static intptr_t FrameSize(const TypedData &packed)
bool IsNull() const
Definition object.h:363
static Object & Handle()
Definition object.h:407
#define ASSERT(E)

Member Function Documentation

◆ Advance()

void dart::InlinedFunctionsIterator::Advance ( )

Definition at line 701 of file stack_frame.cc.

701 {
702 // Iterate over the deopt instructions and determine the inlined
703 // functions if any and iterate over them.
704 ASSERT(!Done());
705
706#if defined(DART_PRECOMPILED_RUNTIME)
707 ASSERT(deopt_info_.IsNull());
708 SetDone();
709 return;
710#else
711 if (deopt_info_.IsNull()) {
712 SetDone();
713 return;
714 }
715
716 ASSERT(deopt_instructions_.length() != 0);
717 while (index_ < deopt_instructions_.length()) {
718 DeoptInstr* deopt_instr = deopt_instructions_[index_++];
719 if (deopt_instr->kind() == DeoptInstr::kRetAddress) {
720 pc_ = DeoptInstr::GetRetAddress(deopt_instr, object_table_, &code_);
721 function_ = code_.function();
722 return;
723 }
724 }
725 SetDone();
726#endif // defined(DART_PRECOMPILED_RUNTIME)
727}
static uword GetRetAddress(DeoptInstr *instr, const ObjectPool &object_pool, Code *code)

◆ code()

CodePtr dart::InlinedFunctionsIterator::code ( ) const
inline

Definition at line 383 of file stack_frame.h.

383 {
384 ASSERT(!Done());
385 return code_.ptr();
386 }
ObjectPtr ptr() const
Definition object.h:332

◆ Done()

bool dart::InlinedFunctionsIterator::Done ( ) const
inline

Definition at line 370 of file stack_frame.h.

370{ return index_ == -1; }

◆ function()

FunctionPtr dart::InlinedFunctionsIterator::function ( ) const
inline

Definition at line 373 of file stack_frame.h.

373 {
374 ASSERT(!Done());
375 return function_.ptr();
376 }

◆ GetDeoptFpOffset()

intptr_t dart::InlinedFunctionsIterator::GetDeoptFpOffset ( ) const

Definition at line 732 of file stack_frame.cc.

732 {
733 ASSERT(deopt_instructions_.length() != 0);
734 for (intptr_t index = index_; index < deopt_instructions_.length(); index++) {
735 DeoptInstr* deopt_instr = deopt_instructions_[index];
736 if (deopt_instr->kind() == DeoptInstr::kCallerFp) {
737 return index - num_materializations_ - kSavedCallerFpSlotFromFp;
738 }
739 }
740 UNREACHABLE();
741 return 0;
742}
#define UNREACHABLE()
Definition assert.h:248
static constexpr int kSavedCallerFpSlotFromFp

◆ pc()

uword dart::InlinedFunctionsIterator::pc ( ) const
inline

Definition at line 378 of file stack_frame.h.

378 {
379 ASSERT(!Done());
380 return pc_;
381 }

The documentation for this class was generated from the following files: