| Index: runtime/vm/profiler.h
|
| diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h
|
| index d93d648caac43cb72a5256eee3d9a7fd9555ae2d..f49c2a82d6c850a16104a499d5192148ee57ccb1 100644
|
| --- a/runtime/vm/profiler.h
|
| +++ b/runtime/vm/profiler.h
|
| @@ -106,6 +106,28 @@ class SampleVisitor : public ValueObject {
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(SampleVisitor);
|
| };
|
|
|
| +
|
| +class FixTopFrameVisitor : public SampleVisitor {
|
| + public:
|
| + explicit FixTopFrameVisitor(Isolate* isolate);
|
| +
|
| + virtual void VisitSample(Sample* sample);
|
| +
|
| + private:
|
| + void CheckForMissingDartFrame(const Code& code, Sample* sample) const;
|
| +
|
| + bool ContainedInDartCodeHeaps(uword pc) const;
|
| +
|
| + Isolate* vm_isolate() const {
|
| + return vm_isolate_;
|
| + }
|
| +
|
| + RawCode* FindCodeForPC(uword pc) const;
|
| +
|
| + Isolate* vm_isolate_;
|
| +};
|
| +
|
| +
|
| // Each Sample holds a stack trace from an isolate.
|
| class Sample {
|
| public:
|
| @@ -117,6 +139,7 @@ class Sample {
|
| vm_tag_ = VMTag::kInvalidTagId;
|
| user_tag_ = UserTags::kDefaultUserTag;
|
| sp_ = 0;
|
| + possible_return_address_ = 0;
|
| fp_ = 0;
|
| state_ = 0;
|
| uword* pcs = GetPCArray();
|
| @@ -190,6 +213,14 @@ class Sample {
|
| fp_ = fp;
|
| }
|
|
|
| + uword possible_return_address() const {
|
| + return possible_return_address_;
|
| + }
|
| +
|
| + void set_possible_return_address(uword possible_return_address) {
|
| + possible_return_address_ = possible_return_address;
|
| + }
|
| +
|
| void InsertCallerForTopFrame(uword pc) {
|
| if (pcs_length_ == 1) {
|
| // Only sampling top frame.
|
| @@ -203,6 +234,7 @@ class Sample {
|
| }
|
| // Insert caller for top frame.
|
| pcs[1] = pc;
|
| + set_missing_frame_inserted(true);
|
| }
|
|
|
| bool processed() const {
|
| @@ -237,6 +269,14 @@ class Sample {
|
| state_ = ExitFrameBit::update(exit_frame_sample, state_);
|
| }
|
|
|
| + bool missing_frame_inserted() const {
|
| + return MissingFrameInsertedBit::decode(state_);
|
| + }
|
| +
|
| + void set_missing_frame_inserted(bool missing_frame_inserted) {
|
| + state_ = MissingFrameInsertedBit::update(missing_frame_inserted, state_);
|
| + }
|
| +
|
| static void InitOnce();
|
|
|
| static intptr_t instance_size() {
|
| @@ -245,6 +285,11 @@ class Sample {
|
|
|
| uword* GetPCArray() const;
|
|
|
| + static const int kStackBufferSizeInWords = 3;
|
| + uword* GetStackBuffer() {
|
| + return &stack_buffer_[0];
|
| + }
|
| +
|
| private:
|
| static intptr_t instance_size_;
|
| static intptr_t pcs_length_;
|
| @@ -253,16 +298,20 @@ class Sample {
|
| kLeafFrameIsDartBit = 1,
|
| kIgnoreBit = 2,
|
| kExitFrameBit = 3,
|
| + kMissingFrameInsertedBit = 4,
|
| };
|
| class ProcessedBit : public BitField<bool, kProcessedBit, 1> {};
|
| class LeafFrameIsDart : public BitField<bool, kLeafFrameIsDartBit, 1> {};
|
| class IgnoreBit : public BitField<bool, kIgnoreBit, 1> {};
|
| class ExitFrameBit : public BitField<bool, kExitFrameBit, 1> {};
|
| -
|
| + class MissingFrameInsertedBit
|
| + : public BitField<bool, kMissingFrameInsertedBit, 1> {};
|
| int64_t timestamp_;
|
| ThreadId tid_;
|
| Isolate* isolate_;
|
| uword pc_marker_;
|
| + uword stack_buffer_[kStackBufferSizeInWords];
|
| + uword possible_return_address_;
|
| uword vm_tag_;
|
| uword user_tag_;
|
| uword sp_;
|
|
|