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

Unified Diff: runtime/vm/profiler.cc

Issue 180243013: Stop creating dummy call frames when calling out to C functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index 46c62fb46a8980b672d7251d9b57918dfb82fc31..f41a017276cb8eaf37bc46dfa69f6201606ab5d1 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -874,13 +874,15 @@ Sample* SampleBuffer::ReserveSample() {
//
class ProfilerSampleStackWalker : public ValueObject {
public:
- ProfilerSampleStackWalker(Sample* sample,
+ ProfilerSampleStackWalker(Heap* heap,
+ Sample* sample,
uword stack_lower,
uword stack_upper,
uword pc,
uword fp,
uword sp)
- : sample_(sample),
+ : heap_(heap),
+ sample_(sample),
stack_upper_(stack_upper),
original_pc_(pc),
original_fp_(fp),
@@ -918,6 +920,9 @@ class ProfilerSampleStackWalker : public ValueObject {
}
int i = 0;
for (; i < FLAG_profile_depth; i++) {
+#if defined(DEBUG_STACK_WALK)
+ VerifyCodeAddress(i, reinterpret_cast<uword>(pc));
+#endif
sample_->SetAt(i, reinterpret_cast<uword>(pc));
if (!ValidFramePointer(fp)) {
return i + 1;
@@ -939,6 +944,22 @@ class ProfilerSampleStackWalker : public ValueObject {
}
private:
+#if defined(DEBUG_STACK_WALK)
+ void VerifyCodeAddress(int i, uword pc) {
+ if (heap_ != NULL) {
+ if (heap_->Contains(pc) && !heap_->CodeContains(pc)) {
+ for (int j = 0; j < i; j++) {
+ OS::Print("%d %" Px "\n", j, sample_->At(j));
+ }
+ OS::Print("%d %" Px " <--\n", i, pc);
+ OS::Print("---ASSERT-FAILED---\n");
+ OS::Print("%" Px " %" Px "\n", original_pc_, original_fp_);
+ UNREACHABLE();
+ }
+ }
+ }
+#endif
+
uword* CallerPC(uword* fp) const {
ASSERT(fp != NULL);
return reinterpret_cast<uword*>(*(fp + kSavedCallerPcSlotFromFp));
@@ -959,6 +980,7 @@ class ProfilerSampleStackWalker : public ValueObject {
return r;
}
+ Heap* heap_;
Sample* sample_;
const uword stack_upper_;
const uword original_pc_;
@@ -991,8 +1013,9 @@ void Profiler::RecordSampleInterruptCallback(
stack_lower = 0;
stack_upper = 0;
}
- ProfilerSampleStackWalker stackWalker(sample, stack_lower, stack_upper,
- state.pc, state.fp, state.sp);
+ ProfilerSampleStackWalker stackWalker(isolate->heap(), sample, stack_lower,
+ stack_upper, state.pc, state.fp,
+ state.sp);
stackWalker.walk();
}
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698