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

Unified Diff: runtime/vm/profiler.cc

Issue 2250823002: Partially implement DBC profiler. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 4 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/signal_handler_macos.cc » ('j') | 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 ddd5b26817bfdea01f4dd4b7ff9d14ba51db6256..d6fcec326812ab1c572fd9cb9ff18c7c12262c26 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -529,8 +529,9 @@ class ProfilerDartStackWalker : public ProfilerStackWalker {
return NextExit();
}
uword* new_fp = CallerFP();
- if (new_fp <= fp_) {
- // FP didn't move to a higher address.
+ if (!IsCalleeFrameOf(reinterpret_cast<uword>(new_fp),
+ reinterpret_cast<uword>(fp_))) {
+ // FP didn't move to a caller (higher address on most architectures).
return false;
}
// Success, update fp and pc.
@@ -859,10 +860,18 @@ static bool GetAndValidateIsolateStackBounds(Thread* thread,
return false;
}
#endif
+
+#if defined(TARGET_ARCH_DBC)
+ if (!in_dart_code && (sp > *stack_lower)) {
+ // The stack pointer gives us a tighter lower bound.
+ *stack_lower = sp;
+ }
+#else
if (sp > *stack_lower) {
// The stack pointer gives us a tighter lower bound.
*stack_lower = sp;
}
+#endif
if (*stack_lower >= *stack_upper) {
// Stack boundary is invalid.
@@ -1125,11 +1134,6 @@ void Profiler::SampleThreadSingleFrame(Thread* thread, uintptr_t pc) {
void Profiler::SampleThread(Thread* thread,
const InterruptedThreadState& state) {
-#if defined(TARGET_ARCH_DBC)
- // TODO(vegorov) implement simulator stack sampling.
- return;
-#endif
-
ASSERT(thread != NULL);
OSThread* os_thread = thread->os_thread();
ASSERT(os_thread != NULL);
@@ -1155,14 +1159,17 @@ void Profiler::SampleThread(Thread* thread,
uintptr_t sp = 0;
uintptr_t fp = state.fp;
uintptr_t pc = state.pc;
-#if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC)
+#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(TARGET_ARCH_DBC)
- UNIMPLEMENTED();
+ simulator = isolate->simulator();
+ sp = simulator->get_sp();
+ fp = simulator->get_fp();
+ pc = simulator->get_pc();
#elif defined(USING_SIMULATOR)
simulator = isolate->simulator();
sp = simulator->get_register(SPREG);
« no previous file with comments | « no previous file | runtime/vm/signal_handler_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698