Revision: 18849
Author:   [email protected]
Date:     Mon Jan 27 10:54:11 2014 UTC
Log: A64: Fix sampling of fp register for CPU profile and bailout if sp or fp is zero.

TEST=cctest/test-cpu-profiler
[email protected]

Review URL: https://codereview.chromium.org/145583004
http://code.google.com/p/v8/source/detail?r=18849

Modified:
 /branches/experimental/a64/src/a64/simulator-a64.h
 /branches/experimental/a64/src/sampler.cc

=======================================
--- /branches/experimental/a64/src/a64/simulator-a64.h Wed Jan 22 12:46:44 2014 UTC +++ /branches/experimental/a64/src/a64/simulator-a64.h Mon Jan 27 10:54:11 2014 UTC
@@ -440,6 +440,9 @@

   inline int64_t sp() { return xreg(31, Reg31IsStackPointer); }
   inline int64_t jssp() { return xreg(kJSSPCode, Reg31IsStackPointer); }
+  inline int64_t fp() {
+      return xreg(kFramePointerRegCode, Reg31IsStackPointer);
+  }
   inline Instruction* lr() { return reg<Instruction*>(kLinkRegCode); }

   // Return 'size' bits of the value of a floating-point register, as the
=======================================
--- /branches/experimental/a64/src/sampler.cc   Fri Jan 24 14:31:05 2014 UTC
+++ /branches/experimental/a64/src/sampler.cc   Mon Jan 27 10:54:11 2014 UTC
@@ -256,9 +256,16 @@
     sample->fp = reinterpret_cast<Address>(simulator_->get_register(
         Simulator::r11));
 #elif V8_TARGET_ARCH_A64
+    if (simulator_->sp() == 0 || simulator_->fp() == 0) {
+      // It possible that the simulator is interrupted while it is updating
+      // the sp or fp register. A64 simulator does this in two steps:
+      // first setting it to zero and then setting it to the new value.
+      // Bailout if sp/fp doesn't contain the new value.
+      return;
+    }
     sample->pc = reinterpret_cast<Address>(simulator_->pc());
     sample->sp = reinterpret_cast<Address>(simulator_->sp());
-    sample->fp = reinterpret_cast<Address>(simulator_->lr());
+    sample->fp = reinterpret_cast<Address>(simulator_->fp());
 #elif V8_TARGET_ARCH_MIPS
     sample->pc = reinterpret_cast<Address>(simulator_->get_pc());
     sample->sp = reinterpret_cast<Address>(simulator_->get_register(
@@ -341,10 +348,10 @@
 #if defined(USE_SIMULATOR)
   helper.FillRegisters(sample);
   // It possible that the simulator is interrupted while it is updating
-  // the sp register. A64 simulator does this in two steps:
+  // the sp or fp register. A64 simulator does this in two steps:
   // first setting it to zero and then setting it to the new value.
-  // Bailout if sp doesn't contain the new value.
-  if (sample->sp == 0) return;
+  // Bailout if sp/fp doesn't contain the new value.
+  if (sample->sp == 0 || sample->fp == 0) return;
 #else
   // Extracting the sample from the context is extremely machine dependent.
   ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to