From 883b2826b9ae56d25c61c320d49022cacae816a9 Mon Sep 17 00:00:00 2001 From: "lrn@chromium.org" Date: Thu, 7 May 2009 09:34:16 +0000 Subject: [PATCH] X64: Changed TickSample to hold pointer-sized values for registers. Review URL: http://codereview.chromium.org/113094 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1894 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/log.cc | 2 +- src/platform-linux.cc | 1 - src/platform-win32.cc | 7 +++++++ src/platform.h | 6 +++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/log.cc b/src/log.cc index b5ea33c..6047a58 100644 --- a/src/log.cc +++ b/src/log.cc @@ -1072,7 +1072,7 @@ void Logger::DebugEvent(const char* event_type, Vector parameter) { void Logger::TickEvent(TickSample* sample, bool overflow) { if (!Log::is_enabled() || !FLAG_prof) return; LogMessageBuilder msg; - msg.Append("tick,0x%x,0x%x,%d", sample->pc, sample->sp, + msg.Append("tick,0x%"V8PRIp",0x%"V8PRIp",%d", sample->pc, sample->sp, static_cast(sample->state)); if (overflow) { msg.Append(",overflow"); diff --git a/src/platform-linux.cc b/src/platform-linux.cc index 026d251..c02eebc 100644 --- a/src/platform-linux.cc +++ b/src/platform-linux.cc @@ -605,7 +605,6 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { 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]; diff --git a/src/platform-win32.cc b/src/platform-win32.cc index 597a217..6c4e67a 100644 --- a/src/platform-win32.cc +++ b/src/platform-win32.cc @@ -1775,9 +1775,16 @@ class Sampler::PlatformData : public Malloced { context.ContextFlags = CONTEXT_FULL; GetThreadContext(profiled_thread_, &context); // Invoke tick handler with program counter and stack pointer. +#if V8_HOST_ARCH_X64 + UNIMPLEMENTED(); + sample.pc = context.Rip; + sample.sp = context.Rsp; + sample.fp = context.Rbp; +#else sample.pc = context.Eip; sample.sp = context.Esp; sample.fp = context.Ebp; +#endif } // We always sample the VM state. diff --git a/src/platform.h b/src/platform.h index a346615..e23abfc 100644 --- a/src/platform.h +++ b/src/platform.h @@ -492,9 +492,9 @@ class Socket { class TickSample { public: TickSample() : pc(0), sp(0), fp(0), state(OTHER) {} - unsigned int pc; // Instruction pointer. - unsigned int sp; // Stack pointer. - unsigned int fp; // Frame pointer. + uintptr_t pc; // Instruction pointer. + uintptr_t sp; // Stack pointer. + uintptr_t fp; // Frame pointer. StateTag state; // The state of the VM. static const int kMaxFramesCount = 100; EmbeddedVector stack; // Call stack. -- 2.7.4