Add API for configuring the number of threads used by DFG and FTL
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Jun 2018 18:30:47 +0000 (18:30 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Jun 2018 18:30:47 +0000 (18:30 +0000)
commit160d19f451b26cbbcc62cb845354a483fabeb40b
tree87ee5244d0a03cf97f83abf66c93ca3783747de8
parenta84860f62eab3475a72dc0100add19b09513bb38
Add API for configuring the number of threads used by DFG and FTL
https://bugs.webkit.org/show_bug.cgi?id=186859
<rdar://problem/41093519>

Patch by Tadeu Zagallo <tzagallo@apple.com> on 2018-06-25
Reviewed by Filip Pizlo.

Add new private APIs for limiting the number of threads to be used by
the DFG and FTL compilers. It was already possible to configure the
limit through JSC Options, but now it can be changed at runtime, even
in the case when the VM is already running.

Add a test for both cases: when trying to configure the limit before
and after the Worklist has been created, but in order to simulate the
first scenario, we must guarantee that the test runs at the very
beginning, so I also added a check for that.

* API/JSVirtualMachine.mm:
(+[JSVirtualMachine setNumberOfDFGCompilerThreads:]):
(+[JSVirtualMachine setNumberOfFTLCompilerThreads:]):
* API/JSVirtualMachinePrivate.h:
* API/tests/testapi.mm:
(runJITThreadLimitTests):
(testObjectiveCAPIMain):
* dfg/DFGWorklist.cpp:
(JSC::DFG::Worklist::finishCreation):
(JSC::DFG::Worklist::createNewThread):
(JSC::DFG::Worklist::setNumberOfThreads):
* dfg/DFGWorklist.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233158 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/API/JSVirtualMachine.mm
Source/JavaScriptCore/API/JSVirtualMachinePrivate.h
Source/JavaScriptCore/API/tests/testapi.mm
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGWorklist.cpp
Source/JavaScriptCore/dfg/DFGWorklist.h