summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/tools/CodeProfiling.cpp
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-08-25 19:20:41 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-02-02 12:30:55 +0000
commit6882a04fb36642862b11efe514251d32070c3d65 (patch)
treeb7959826000b061fd5ccc7512035c7478742f7b0 /Source/JavaScriptCore/tools/CodeProfiling.cpp
parentab6df191029eeeb0b0f16f127d553265659f739e (diff)
downloadqtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/JavaScriptCore/tools/CodeProfiling.cpp')
-rw-r--r--Source/JavaScriptCore/tools/CodeProfiling.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/Source/JavaScriptCore/tools/CodeProfiling.cpp b/Source/JavaScriptCore/tools/CodeProfiling.cpp
index f545be903..302b5f929 100644
--- a/Source/JavaScriptCore/tools/CodeProfiling.cpp
+++ b/Source/JavaScriptCore/tools/CodeProfiling.cpp
@@ -33,7 +33,7 @@
#include <signal.h>
#endif
-#if OS(LINUX)
+#if OS(LINUX) || OS(DARWIN)
#include <sys/time.h>
#endif
@@ -48,7 +48,7 @@ WTF::MetaAllocatorTracker* CodeProfiling::s_tracker = 0;
#pragma clang diagnostic ignored "-Wmissing-noreturn"
#endif
-#if (PLATFORM(MAC) && CPU(X86_64)) || (OS(LINUX) && CPU(X86) && !OS(ANDROID))
+#if (OS(DARWIN) && !PLATFORM(EFL) && !PLATFORM(GTK) && CPU(X86_64)) || (OS(LINUX) && CPU(X86))
// Helper function to start & stop the timer.
// Presently we're using the wall-clock timer, since this seems to give the best results.
static void setProfileTimer(unsigned usec)
@@ -66,14 +66,14 @@ static void setProfileTimer(unsigned usec)
#pragma clang diagnostic pop
#endif
-#if PLATFORM(MAC) && CPU(X86_64)
+#if OS(DARWIN) && !PLATFORM(EFL) && !PLATFORM(GTK) && CPU(X86_64)
static void profilingTimer(int, siginfo_t*, void* uap)
{
mcontext_t context = static_cast<ucontext_t*>(uap)->uc_mcontext;
CodeProfiling::sample(reinterpret_cast<void*>(context->__ss.__rip),
reinterpret_cast<void**>(context->__ss.__rbp));
}
-#elif OS(LINUX) && CPU(X86) && !OS(ANDROID)
+#elif OS(LINUX) && CPU(X86)
static void profilingTimer(int, siginfo_t*, void* uap)
{
mcontext_t context = static_cast<ucontext_t*>(uap)->uc_mcontext;
@@ -92,7 +92,6 @@ void CodeProfiling::sample(void* pc, void** framePointer)
void CodeProfiling::notifyAllocator(WTF::MetaAllocator* allocator)
{
-#if !OS(WINCE)
// Check for JSC_CODE_PROFILING.
const char* codeProfilingMode = getenv("JSC_CODE_PROFILING");
if (!codeProfilingMode)
@@ -119,7 +118,6 @@ void CodeProfiling::notifyAllocator(WTF::MetaAllocator* allocator)
ASSERT(!s_tracker);
s_tracker = new WTF::MetaAllocatorTracker();
allocator->trackAllocations(s_tracker);
-#endif
}
void* CodeProfiling::getOwnerUIDForPC(void* address)
@@ -143,7 +141,7 @@ void CodeProfiling::begin(const SourceCode& source)
if (alreadyProfiling)
return;
-#if (PLATFORM(MAC) && CPU(X86_64)) || (OS(LINUX) && CPU(X86) && !OS(ANDROID))
+#if (OS(DARWIN) && !PLATFORM(EFL) && !PLATFORM(GTK) && CPU(X86_64)) || (OS(LINUX) && CPU(X86))
// Regsiter a signal handler & itimer.
struct sigaction action;
action.sa_sigaction = reinterpret_cast<void (*)(int, siginfo_t *, void *)>(profilingTimer);
@@ -167,7 +165,7 @@ void CodeProfiling::end()
if (s_profileStack)
return;
-#if (PLATFORM(MAC) && CPU(X86_64)) || (OS(LINUX) && CPU(X86) && !OS(ANDROID))
+#if (OS(DARWIN) && !PLATFORM(EFL) && !PLATFORM(GTK) && CPU(X86_64)) || (OS(LINUX) && CPU(X86))
// Stop profiling
setProfileTimer(0);
#endif