Have the profiler load the correct registers on x64.
authordeanm@chromium.org <deanm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 6 May 2009 11:19:50 +0000 (11:19 +0000)
committerdeanm@chromium.org <deanm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 6 May 2009 11:19:50 +0000 (11:19 +0000)
This is still not correct, since internally they are kept as an int.
Use our new V8_HOST_ARCH macros for detecting the host processor.

Review URL: http://codereview.chromium.org/109025

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1879 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/platform-linux.cc

index c735ceb..418113b 100644 (file)
@@ -600,14 +600,19 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
     // Extracting the sample from the context is extremely machine dependent.
     ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
     mcontext_t& mcontext = ucontext->uc_mcontext;
-#if defined(__arm__) || defined(__thumb__)
-    sample.pc = mcontext.gregs[R15];
-    sample.sp = mcontext.gregs[R13];
-    sample.fp = mcontext.gregs[R11];
-#else
+#if V8_HOST_ARCH_X86
     sample.pc = mcontext.gregs[REG_EIP];
     sample.sp = mcontext.gregs[REG_ESP];
     sample.fp = mcontext.gregs[REG_EBP];
+#elif V8_HOST_ARCH_X64
+    UNIMPLEMENTED();
+    sample.pc = mcontext.gregs[REG_RIP];
+    sample.sp = mcontext.gregs[REG_RSP];
+    sample.fp = mcontext.gregs[REG_RBP];
+#elif V8_HOST_ARCH_ARM
+    sample.pc = mcontext.gregs[R15];
+    sample.sp = mcontext.gregs[R13];
+    sample.fp = mcontext.gregs[R11];
 #endif
   }