Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(801)

Unified Diff: runtime/vm/profiler.h

Issue 928833003: Add Function based profile tree (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698