Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::ProfilerDartStackWalker Class Reference
Inheritance diagram for dart::ProfilerDartStackWalker:
dart::ProfilerStackWalker dart::ValueObject

Public Member Functions

 ProfilerDartStackWalker (Thread *thread, Sample *sample, SampleBuffer *sample_buffer, uword pc, uword fp, uword sp, uword lr, bool allocation_sample, intptr_t skip_count=0)
 
void walk ()
 
- Public Member Functions inherited from dart::ProfilerStackWalker
 ProfilerStackWalker (Dart_Port port_id, Sample *head_sample, SampleBuffer *sample_buffer, intptr_t skip_count=0)
 
bool Append (uword pc, uword fp)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Additional Inherited Members

- Protected Attributes inherited from dart::ProfilerStackWalker
Dart_Port port_id_
 
Samplesample_
 
SampleBuffersample_buffer_
 
intptr_t skip_count_
 
intptr_t frames_skipped_
 
intptr_t frame_index_
 
intptr_t total_frames_
 

Detailed Description

Definition at line 995 of file profiler.cc.

Constructor & Destructor Documentation

◆ ProfilerDartStackWalker()

dart::ProfilerDartStackWalker::ProfilerDartStackWalker ( Thread thread,
Sample sample,
SampleBuffer sample_buffer,
uword  pc,
uword  fp,
uword  sp,
uword  lr,
bool  allocation_sample,
intptr_t  skip_count = 0 
)
inline

Definition at line 997 of file profiler.cc.

1006 : ProfilerStackWalker((thread->isolate() != nullptr)
1007 ? thread->isolate()->main_port()
1008 : ILLEGAL_PORT,
1009 sample,
1010 sample_buffer,
1011 skip_count),
1012 thread_(thread),
1013 pc_(reinterpret_cast<uword*>(pc)),
1014 fp_(reinterpret_cast<uword*>(fp)),
1015 sp_(reinterpret_cast<uword*>(sp)),
1016 lr_(reinterpret_cast<uword*>(lr)) {}
ProfilerStackWalker(Dart_Port port_id, Sample *head_sample, SampleBuffer *sample_buffer, intptr_t skip_count=0)
Definition profiler.cc:126
#define ILLEGAL_PORT
Definition dart_api.h:1530
uintptr_t uword
Definition globals.h:501
const uint32_t fp

Member Function Documentation

◆ walk()

void dart::ProfilerDartStackWalker::walk ( )
inline

Definition at line 1018 of file profiler.cc.

1018 {
1020 if (thread_->isolate()->IsDeoptimizing()) {
1022 return;
1023 }
1024
1025 uword* exit_fp = reinterpret_cast<uword*>(thread_->top_exit_frame_info());
1026 bool has_exit_frame = exit_fp != nullptr;
1027 if (has_exit_frame) {
1028 // Exited from compiled code.
1029 pc_ = nullptr;
1030 fp_ = exit_fp;
1031
1032 // Skip exit frame.
1033 pc_ = CallerPC();
1034 fp_ = CallerFP();
1035 } else {
1036 if (thread_->vm_tag() == VMTag::kDartTagId) {
1037 // Running compiled code.
1038 // Use the FP and PC from the thread interrupt or simulator; already set
1039 // in the constructor.
1040 } else {
1041 // No Dart on the stack; caller shouldn't use this walker.
1042 UNREACHABLE();
1043 }
1044
1045 const bool is_entry_frame =
1046#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
1047 StubCode::InInvocationStub(Stack(0)) ||
1049#else
1050 StubCode::InInvocationStub(reinterpret_cast<uword>(lr_));
1051#endif
1052 if (is_entry_frame) {
1053 // During the prologue of a function, CallerPC will return the caller's
1054 // caller. For most frames, the missing PC will be added during profile
1055 // processing. However, during this stack walk, it can cause us to fail
1056 // to identify the entry frame and lead the stack walk into the weeds.
1057 // Do not continue the stalk walk since this might be a false positive
1058 // from a Smi or unboxed value.
1060 return;
1061 }
1062 }
1063
1064 sample_->set_exit_frame_sample(has_exit_frame);
1065
1066 for (;;) {
1067 // Skip entry frame.
1068 if (StubCode::InInvocationStub(reinterpret_cast<uword>(pc_))) {
1069 pc_ = nullptr;
1070 fp_ = ExitLink();
1071 if (fp_ == nullptr) {
1072 break; // End of Dart stack.
1073 }
1074
1075 // Skip exit frame.
1076 pc_ = CallerPC();
1077 fp_ = CallerFP();
1078
1079 // At least one frame between exit and next entry frame.
1081 !StubCode::InInvocationStub(reinterpret_cast<uword>(pc_)));
1082 }
1083
1084 if (!Append(reinterpret_cast<uword>(pc_), reinterpret_cast<uword>(fp_))) {
1085 break; // Sample is full.
1086 }
1087
1088 pc_ = CallerPC();
1089 fp_ = CallerFP();
1090 }
1091 }
#define UNREACHABLE()
Definition assert.h:248
#define RELEASE_ASSERT(cond)
Definition assert.h:327
bool IsDeoptimizing() const
Definition isolate.h:1207
bool Append(uword pc, uword fp)
Definition profiler.cc:145
void set_ignore_sample(bool ignore_sample)
Definition profiler.h:282
void set_exit_frame_sample(bool exit_frame_sample)
Definition profiler.h:288
static bool HasBeenInitialized()
Definition stub_code.h:41
static bool InInvocationStub(uword pc)
Definition stub_code.cc:132
uword vm_tag() const
Definition thread.h:808
uword top_exit_frame_info() const
Definition thread.h:678
Isolate * isolate() const
Definition thread.h:533

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