Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 81e9f6868ad1953daa05923a488fc205322fceb3
https://github.com/WebKit/WebKit/commit/81e9f6868ad1953daa05923a488fc205322fceb3
Author: Yusuke Suzuki <[email protected]>
Date: 2024-07-18 (Thu, 18 Jul 2024)
Changed paths:
A JSTests/microbenchmarks/math-max.js
M Source/JavaScriptCore/b3/B3Common.h
M Source/JavaScriptCore/b3/B3ConstDoubleValue.cpp
M Source/JavaScriptCore/b3/B3ConstFloatValue.cpp
M Source/JavaScriptCore/dfg/DFGOperations.cpp
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
M Source/JavaScriptCore/ftl/FTLOutput.cpp
M Source/JavaScriptCore/ftl/FTLOutput.h
M Source/JavaScriptCore/jit/ThunkGenerators.cpp
M Source/JavaScriptCore/jit/ThunkGenerators.h
M Source/JavaScriptCore/runtime/MathCommon.h
M Source/JavaScriptCore/runtime/MathObject.cpp
Log Message:
-----------
[JSC] Optimize and clean up Min / Max
https://bugs.webkit.org/show_bug.cgi?id=276694
rdar://131882633
Reviewed by Justin Michaud.
This patch does holistic Math.min / Math.max optimization.
1. We add thunks for them in ARM64, which have super fast path for Int32-Int32
/ Int32-Double / Double-Int32 / Double-Double. (We do not use it for now, we
need a bit tweaking)
2. Use ARM64 fmax / fmin in DFG and FTL JIT and thunk. The semantics of fmax /
fmin is aligned to JS's semantics, so we can leverage it.
3. Add jsMaxDouble / jsMinDouble and use them in Math.max / Math.min runtime
functions.
4. Use inline asm to use fmax / fmin in jsMaxDouble / jsMinDouble in ARM64.
Simple FTL perf is getting 11% faster.
ToT Patched
math-max 10.4292+-0.1181 ^ 9.3465+-0.0937 ^
definitely 1.1158x faster
And if we disable DFG / FTL, Math.min / Math.max are 1.9x faster.
ToT Patched
math-max 50.0668+-0.3260 ^ 26.2990+-0.0774 ^
definitely 1.9038x faster
* JSTests/microbenchmarks/math-max.js: Added.
(max):
* Source/JavaScriptCore/b3/B3Common.h:
(JSC::B3::fMax): Deleted.
(JSC::B3::fMin): Deleted.
* Source/JavaScriptCore/b3/B3ConstDoubleValue.cpp:
(JSC::B3::ConstDoubleValue::fMinConstant const):
(JSC::B3::ConstDoubleValue::fMaxConstant const):
* Source/JavaScriptCore/b3/B3ConstFloatValue.cpp:
(JSC::B3::ConstFloatValue::fMinConstant const):
(JSC::B3::ConstFloatValue::fMaxConstant const):
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_NOEXCEPT_JIT_OPERATION):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileArithMinOrMax):
* Source/JavaScriptCore/ftl/FTLOutput.cpp:
(JSC::FTL::Output::doubleMax):
(JSC::FTL::Output::doubleMin):
* Source/JavaScriptCore/ftl/FTLOutput.h:
* Source/JavaScriptCore/jit/ThunkGenerators.cpp:
(JSC::maxThunkGenerator):
(JSC::minThunkGenerator):
* Source/JavaScriptCore/jit/ThunkGenerators.h:
* Source/JavaScriptCore/runtime/MathCommon.h:
(JSC::Math::fMax):
(JSC::Math::fMin):
(JSC::Math::jsMaxDouble):
(JSC::Math::jsMinDouble):
* Source/JavaScriptCore/runtime/MathObject.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::thunkGeneratorForIntrinsic):
Canonical link: https://commits.webkit.org/281118@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes