Commit d3eeaf17 authored by whesse@chromium.org's avatar whesse@chromium.org

X64: Implement tickprocessor sampling on 64-bit MacOS. This issue on...

X64: Implement tickprocessor sampling on 64-bit MacOS.  This issue on codereview has been accidentally reused from an earlier issue by a process mistake.
Review URL: http://codereview.chromium.org/151004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2640 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 863582ba
...@@ -515,35 +515,31 @@ class Sampler::PlatformData : public Malloced { ...@@ -515,35 +515,31 @@ class Sampler::PlatformData : public Malloced {
thread_state_flavor_t flavor = x86_THREAD_STATE64; thread_state_flavor_t flavor = x86_THREAD_STATE64;
x86_thread_state64_t state; x86_thread_state64_t state;
mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT; mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT;
#if __DARWIN_UNIX03
#define REGISTER_FIELD(name) __r ## name
#else
#define REGISTER_FIELD(name) r ## name
#endif // __DARWIN_UNIX03
#elif V8_HOST_ARCH_IA32 #elif V8_HOST_ARCH_IA32
thread_state_flavor_t flavor = i386_THREAD_STATE; thread_state_flavor_t flavor = i386_THREAD_STATE;
i386_thread_state_t state; i386_thread_state_t state;
mach_msg_type_number_t count = i386_THREAD_STATE_COUNT; mach_msg_type_number_t count = i386_THREAD_STATE_COUNT;
#if __DARWIN_UNIX03
#define REGISTER_FIELD(name) __e ## name
#else
#define REGISTER_FIELD(name) e ## name
#endif // __DARWIN_UNIX03
#else #else
#error Unsupported Mac OS X host architecture. #error Unsupported Mac OS X host architecture.
#endif // V8_TARGET_ARCH_IA32 #endif // V8_HOST_ARCH
if (thread_get_state(profiled_thread_, if (thread_get_state(profiled_thread_,
flavor, flavor,
reinterpret_cast<natural_t*>(&state), reinterpret_cast<natural_t*>(&state),
&count) == KERN_SUCCESS) { &count) == KERN_SUCCESS) {
#if V8_HOST_ARCH_X64 sample.pc = state.REGISTER_FIELD(ip);
UNIMPLEMENTED(); sample.sp = state.REGISTER_FIELD(sp);
sample.pc = 0; sample.fp = state.REGISTER_FIELD(bp);
sample.sp = 0;
sample.fp = 0;
#elif V8_HOST_ARCH_IA32
#if __DARWIN_UNIX03
sample.pc = state.__eip;
sample.sp = state.__esp;
sample.fp = state.__ebp;
#else // !__DARWIN_UNIX03
sample.pc = state.eip;
sample.sp = state.esp;
sample.fp = state.ebp;
#endif // __DARWIN_UNIX03
#else
#error Unsupported Mac OS X host architecture.
#endif // V8_HOST_ARCH_IA32
sampler_->SampleStack(&sample); sampler_->SampleStack(&sample);
} }
thread_resume(profiled_thread_); thread_resume(profiled_thread_);
...@@ -560,6 +556,8 @@ class Sampler::PlatformData : public Malloced { ...@@ -560,6 +556,8 @@ class Sampler::PlatformData : public Malloced {
} }
}; };
#undef REGISTER_FIELD
// Entry point for sampler thread. // Entry point for sampler thread.
static void* SamplerEntry(void* arg) { static void* SamplerEntry(void* arg) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment