[webkit-changes] [WebKit/WebKit] 70f665: [JSC] Optimize 3~ parameter Math.min / Math.max
Yusuke Suzuki
noreply at github.com
Fri Oct 7 13:18:20 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 70f665155e30119d679eaca988e5e26ad70832d1
https://github.com/WebKit/WebKit/commit/70f665155e30119d679eaca988e5e26ad70832d1
Author: Yusuke Suzuki <ysuzuki at apple.com>
Date: 2022-10-07 (Fri, 07 Oct 2022)
Changed paths:
A JSTests/stress/arith-min-max-multiple-constant-fold.js
A JSTests/stress/arith-min-max-multiple.js
M Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
M Source/JavaScriptCore/dfg/DFGArgumentsUtilities.cpp
M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
M Source/JavaScriptCore/dfg/DFGClobberize.h
M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
M Source/JavaScriptCore/dfg/DFGGraph.h
M Source/JavaScriptCore/dfg/DFGNodeType.h
M Source/JavaScriptCore/dfg/DFGOperations.cpp
M Source/JavaScriptCore/dfg/DFGOperations.h
M Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/dfg/DFGValidate.cpp
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Log Message:
-----------
[JSC] Optimize 3~ parameter Math.min / Math.max
https://bugs.webkit.org/show_bug.cgi?id=246202
rdar://100884179
Reviewed by Mark Lam.
We found that JetStream2/chai-wtb is using Math.min(a, b, c) with three parameters,
and DFG / FTL gave up optimization for that right now. This patch changes ArithMin / ArithMax
to take variadic parameters so that we can emit code efficiently.
For Int32, we emit sequence of cmp and cmov, which should be compact and fast. For Double,
if the # of parameters are 3~, we call a runtime function which does max / min efficiently,
since double min/max are more complicated and this avoids bloating code.
This change offers 5-10% improvement in JetStream2/chai-wtb.
* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleMinMax):
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* Source/JavaScriptCore/dfg/DFGGraph.h:
* Source/JavaScriptCore/dfg/DFGNodeType.h:
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/dfg/DFGOperations.h:
* Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/dfg/DFGValidate.cpp:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileArithMinOrMax):
Canonical link: https://commits.webkit.org/255288@main
More information about the webkit-changes
mailing list