Reimplement profiler sampler on Mac OS X to get it working under Chromium.
authormikhail.naganov@gmail.com <mikhail.naganov@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 1 Jul 2009 08:46:59 +0000 (08:46 +0000)
committermikhail.naganov@gmail.com <mikhail.naganov@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 1 Jul 2009 08:46:59 +0000 (08:46 +0000)
commit8318f5e5f138803bdd2f5ceb83dfa79bf72705f9
tree28b46594c9b1350910ed650315c10ce81289b1c3
parent65e71082d53192c60874f4849cb0388a75aca286
Reimplement profiler sampler on Mac OS X to get it working under Chromium.

Previous implementation of sampler for OS X was copied from the Linux one. But BSD (OS X) and Linux has a very important difference in signal handling. LinuxThreads doesn't support the notion of process-directed signals. So, the SIGPROF signal was directed to the thread that installed the handler---the V8 thread. But on BSD, signal handling is implemented according to POSIX spec, where process-directed signal is to be handled by an arbitrary selected thread. By a coincidence, in V8's sample shell and in Chromium's test shell, V8's thread was picked almost every time, so sampling seemed working. But not in case of Chromium.

So, I've changed the implementation of profiler sampler to use the same scheme as on Windows---a dedicated thread with high priority is used to periodically pause and sample V8's thread.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2315 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
src/log.cc
src/platform-freebsd.cc
src/platform-linux.cc
src/platform-macos.cc
src/platform-win32.cc
src/platform.h