Add an option that exposes functions on the global object to turn on and off the...
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2020 17:44:13 +0000 (17:44 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2020 17:44:13 +0000 (17:44 +0000)
commitc973c9e02c8c4cf37df5a2625e4ce84af82277c9
tree71cc038fc195325b7596aa78f7dcec44d80466b9
parentfdfa89ffb7754c4750fb2bcf16320bd1ad87f5d8
Add an option that exposes functions on the global object to turn on and off the sampling profiler and the super sampler
https://bugs.webkit.org/show_bug.cgi?id=212178

Reviewed by Yusuke Suzuki.

When profiling things like Speedometer inside the browser, it's important to
to only enable the super sampler and the sampling profiler around the code
that you want profiled. Otherwise, you will be profiling things that aren't
relevant to the benchmark score. This patch adds a new option, exposeProfilersOnGlobalObject,
which when true, will expose JS functions on the global object that allow
enabling/disabling the super sampler and the sampling profiler. This way,
we can change the Speedometer source code locally such that these profilers
are only sampling code accounted for in the benchmark score.

* bytecode/SuperSampler.cpp:
(JSC::initializeSuperSampler):
(JSC::enableSuperSampler):
(JSC::disableSuperSampler):
* bytecode/SuperSampler.h:
* jsc.cpp:
(jscmain):
* runtime/JSGlobalObject.cpp:
(JSC::enableSamplingProfiler):
(JSC::disableSamplingProfiler):
(JSC::enableSuperSampler):
(JSC::disableSuperSampler):
(JSC::JSGlobalObject::init):
* runtime/OptionsList.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262014 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/SuperSampler.cpp
Source/JavaScriptCore/bytecode/SuperSampler.h
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/OptionsList.h