diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-05-23 20:16:00 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-05-23 20:16:00 +0200 |
commit | 94988a2b4e6bd85ee8216c65cc8cd73d14cf1ad1 (patch) | |
tree | b10414cf2c2d85136861bae6df7ab1d0295c439a /dom/base | |
parent | 542da56e2c4f992afb50c4222dcf757c3a3e6a5c (diff) | |
download | UXP-94988a2b4e6bd85ee8216c65cc8cd73d14cf1ad1.tar UXP-94988a2b4e6bd85ee8216c65cc8cd73d14cf1ad1.tar.gz UXP-94988a2b4e6bd85ee8216c65cc8cd73d14cf1ad1.tar.lz UXP-94988a2b4e6bd85ee8216c65cc8cd73d14cf1ad1.tar.xz UXP-94988a2b4e6bd85ee8216c65cc8cd73d14cf1ad1.zip |
Remove the jprof profiler.
This resolves #377.
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/nsJSEnvironment.cpp | 109 |
1 files changed, 0 insertions, 109 deletions
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 <signal.h> - -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<JSObject*> aGlobalObj) { @@ -1121,11 +1017,6 @@ nsJSContext::InitClasses(JS::Handle<JSObject*> 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; } |