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

Unified Diff: runtime/vm/profiler.cc

Issue 1107753002: Support profiling of simulated Dart code on mips, arm, and arm64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 8 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/constants_mips.h ('k') | runtime/vm/simulator_arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
===================================================================
--- runtime/vm/profiler.cc (revision 45418)
+++ runtime/vm/profiler.cc (working copy)
@@ -954,10 +954,24 @@
(isolate->vm_tag() == VMTag::kDartTagId);
uintptr_t sp = 0;
+ uintptr_t fp = state.fp;
+ uintptr_t pc = state.pc;
+ uintptr_t lr = state.lr;
+#if defined(USING_SIMULATOR)
+ Simulator* simulator = NULL;
+#endif
if (in_dart_code) {
// If we're in Dart code, use the Dart stack pointer.
+#if defined(USING_SIMULATOR)
+ simulator = isolate->simulator();
+ sp = simulator->get_register(SPREG);
+ fp = simulator->get_register(FPREG);
+ pc = simulator->get_pc();
+ lr = simulator->get_register(LRREG);
+#else
sp = state.dsp;
+#endif
} else {
// If we're in runtime code, use the C stack pointer.
sp = state.csp;
@@ -975,18 +989,18 @@
return;
}
- if ((sp == 0) || (state.fp == 0) || (state.pc == 0)) {
+ if ((sp == 0) || (fp == 0) || (pc == 0)) {
// None of these registers should be zero.
return;
}
- if (sp > state.fp) {
+ if (sp > fp) {
// Assuming the stack grows down, we should never have a stack pointer above
// the frame pointer.
return;
}
- if (StubCode::InJumpToExceptionHandlerStub(state.pc)) {
+ if (StubCode::InJumpToExceptionHandlerStub(pc)) {
// The JumpToExceptionHandler stub manually adjusts the stack pointer,
// frame pointer, and some isolate state before jumping to a catch entry.
// It is not safe to walk the stack when executing this stub.
@@ -995,11 +1009,24 @@
uword stack_lower = 0;
uword stack_upper = 0;
+#if defined(USING_SIMULATOR)
+ if (in_dart_code) {
+ stack_lower = simulator->StackBase();
+ stack_upper = simulator->StackTop();
+ } else if (!isolate->GetProfilerStackBounds(&stack_lower, &stack_upper)) {
+ // Could not get stack boundary.
+ return;
+ }
+ if ((stack_lower == 0) || (stack_upper == 0)) {
+ return;
+ }
+#else
if (!isolate->GetProfilerStackBounds(&stack_lower, &stack_upper) ||
(stack_lower == 0) || (stack_upper == 0)) {
// Could not get stack boundary.
return;
}
+#endif
if (sp > stack_lower) {
// The stack pointer gives us a tighter lower bound.
@@ -1016,7 +1043,7 @@
return;
}
- if ((state.fp < stack_lower) || (state.fp >= stack_upper)) {
+ if ((fp < stack_lower) || (fp >= stack_upper)) {
// Frame pointer is outside isolate stack boundary.
return;
}
@@ -1044,8 +1071,8 @@
sample->set_vm_tag(vm_tag);
sample->set_user_tag(isolate->user_tag());
sample->set_sp(sp);
- sample->set_fp(state.fp);
- sample->set_lr(state.lr);
+ sample->set_fp(fp);
+ sample->set_lr(lr);
CopyStackBuffer(sample);
CopyPCMarkerIfSafe(sample);
@@ -1054,8 +1081,8 @@
ProfilerNativeStackWalker stackWalker(sample,
stack_lower,
stack_upper,
- state.pc,
- state.fp,
+ pc,
+ fp,
sp);
stackWalker.walk();
} else if (exited_dart_code) {
@@ -1068,13 +1095,13 @@
sample,
stack_lower,
stack_upper,
- state.pc,
- state.fp,
+ pc,
+ fp,
sp);
stackWalker.walk();
} else {
sample->set_vm_tag(VMTag::kEmbedderTagId);
- sample->SetAt(0, state.pc);
+ sample->SetAt(0, pc);
}
}
« no previous file with comments | « runtime/vm/constants_mips.h ('k') | runtime/vm/simulator_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698