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

Unified Diff: runtime/vm/profiler_service.h

Issue 2939853002: [fuchsia] Make profile processing resilient to bogus overlaps from dladdr. (Closed)
Patch Set: . Created 3 years, 6 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
« no previous file with comments | « no previous file | runtime/vm/profiler_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler_service.h
diff --git a/runtime/vm/profiler_service.h b/runtime/vm/profiler_service.h
index 8045906e14442710f4cfed8e2663d27a4d32f1a6..b746f510626940455306362e178a37f3b7c6125a 100644
--- a/runtime/vm/profiler_service.h
+++ b/runtime/vm/profiler_service.h
@@ -171,7 +171,10 @@ class ProfileCode : public ZoneAllocated {
uword end() const { return end_; }
void set_end(uword end) { end_ = end; }
- void AdjustExtent(uword start, uword end);
+ void ExpandLower(uword start);
+ void ExpandUpper(uword end);
+ void TruncateLower(uword start);
+ void TruncateUpper(uword end);
bool Contains(uword pc) const { return (pc >= start_) && (pc < end_); }
@@ -239,6 +242,48 @@ class ProfileCode : public ZoneAllocated {
};
+class ProfileCodeTable : public ZoneAllocated {
+ public:
+ ProfileCodeTable() : table_(8) {}
+
+ intptr_t length() const { return table_.length(); }
+
+ ProfileCode* At(intptr_t index) const {
+ ASSERT(index >= 0);
+ ASSERT(index < length());
+ return table_[index];
+ }
+
+ // Find the table index to the ProfileCode containing pc.
+ // Returns < 0 if not found.
+ intptr_t FindCodeIndexForPC(uword pc) const;
+
+ ProfileCode* FindCodeForPC(uword pc) const {
+ intptr_t index = FindCodeIndexForPC(pc);
+ if (index < 0) {
+ return NULL;
+ }
+ return At(index);
+ }
+
+ // Insert |new_code| into the table. Returns the table index where |new_code|
+ // was inserted. Will merge with an overlapping ProfileCode if one is present.
+ intptr_t InsertCode(ProfileCode* new_code);
+
+ private:
+ void FindNeighbors(uword pc,
+ intptr_t* lo,
+ intptr_t* hi,
+ ProfileCode** lo_code,
+ ProfileCode** hi_code) const;
+
+ void VerifyOrder();
+ void VerifyOverlap();
+
+ ZoneGrowableArray<ProfileCode*> table_;
+};
+
+
// Stack traces are organized in a trie. This holds information about one node
// in the trie. A node in a tree represents a stack frame and a path in the tree
// represents a stack trace. Each unique stack trace appears in the tree once
« no previous file with comments | « no previous file | runtime/vm/profiler_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698