From 94988a2b4e6bd85ee8216c65cc8cd73d14cf1ad1 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 23 May 2018 20:16:00 +0200 Subject: Remove the jprof profiler. This resolves #377. --- dom/base/nsJSEnvironment.cpp | 109 ------------------------------------------- 1 file changed, 109 deletions(-) (limited to 'dom/base') diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 576f3052a..3be1a6d2f 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -1006,110 +1006,6 @@ nsJSContext::AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv) return NS_OK; } -#ifdef MOZ_JPROF - -#include - -inline bool -IsJProfAction(struct sigaction *action) -{ - return (action->sa_sigaction && - (action->sa_flags & (SA_RESTART | SA_SIGINFO)) == (SA_RESTART | SA_SIGINFO)); -} - -void NS_JProfStartProfiling(); -void NS_JProfStopProfiling(); -void NS_JProfClearCircular(); - -static bool -JProfStartProfilingJS(JSContext *cx, unsigned argc, JS::Value *vp) -{ - NS_JProfStartProfiling(); - return true; -} - -void NS_JProfStartProfiling() -{ - // Figure out whether we're dealing with SIGPROF, SIGALRM, or - // SIGPOLL profiling (SIGALRM for JP_REALTIME, SIGPOLL for - // JP_RTC_HZ) - struct sigaction action; - - // Must check ALRM before PROF since both are enabled for real-time - sigaction(SIGALRM, nullptr, &action); - //printf("SIGALRM: %p, flags = %x\n",action.sa_sigaction,action.sa_flags); - if (IsJProfAction(&action)) { - //printf("Beginning real-time jprof profiling.\n"); - raise(SIGALRM); - return; - } - - sigaction(SIGPROF, nullptr, &action); - //printf("SIGPROF: %p, flags = %x\n",action.sa_sigaction,action.sa_flags); - if (IsJProfAction(&action)) { - //printf("Beginning process-time jprof profiling.\n"); - raise(SIGPROF); - return; - } - - sigaction(SIGPOLL, nullptr, &action); - //printf("SIGPOLL: %p, flags = %x\n",action.sa_sigaction,action.sa_flags); - if (IsJProfAction(&action)) { - //printf("Beginning rtc-based jprof profiling.\n"); - raise(SIGPOLL); - return; - } - - printf("Could not start jprof-profiling since JPROF_FLAGS was not set.\n"); -} - -static bool -JProfStopProfilingJS(JSContext *cx, unsigned argc, JS::Value *vp) -{ - NS_JProfStopProfiling(); - return true; -} - -void -NS_JProfStopProfiling() -{ - raise(SIGUSR1); - //printf("Stopped jprof profiling.\n"); -} - -static bool -JProfClearCircularJS(JSContext *cx, unsigned argc, JS::Value *vp) -{ - NS_JProfClearCircular(); - return true; -} - -void -NS_JProfClearCircular() -{ - raise(SIGUSR2); - //printf("cleared jprof buffer\n"); -} - -static bool -JProfSaveCircularJS(JSContext *cx, unsigned argc, JS::Value *vp) -{ - // Not ideal... - NS_JProfStopProfiling(); - NS_JProfStartProfiling(); - return true; -} - -static const JSFunctionSpec JProfFunctions[] = { - JS_FS("JProfStartProfiling", JProfStartProfilingJS, 0, 0), - JS_FS("JProfStopProfiling", JProfStopProfilingJS, 0, 0), - JS_FS("JProfClearCircular", JProfClearCircularJS, 0, 0), - JS_FS("JProfSaveCircular", JProfSaveCircularJS, 0, 0), - JS_FS_END -}; - -#endif /* defined(MOZ_JPROF) */ - nsresult nsJSContext::InitClasses(JS::Handle aGlobalObj) { @@ -1121,11 +1017,6 @@ nsJSContext::InitClasses(JS::Handle aGlobalObj) // Attempt to initialize profiling functions ::JS_DefineProfilingFunctions(cx, aGlobalObj); -#ifdef MOZ_JPROF - // Attempt to initialize JProf functions - ::JS_DefineFunctions(cx, aGlobalObj, JProfFunctions); -#endif - return NS_OK; } -- cgit v1.2.3