[webkit-changes] [WebKit/WebKit] 6b2c1f: [JSC] Optimize Array#indexOf in DFG / FTL
Yusuke Suzuki
noreply at github.com
Fri Oct 7 15:17:04 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6b2c1f4318658f9b2dd0f0244adbb1d321579beb
https://github.com/WebKit/WebKit/commit/6b2c1f4318658f9b2dd0f0244adbb1d321579beb
Author: Yusuke Suzuki <ysuzuki at apple.com>
Date: 2022-10-07 (Fri, 07 Oct 2022)
Changed paths:
M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
M Source/JavaScriptCore/dfg/DFGOperations.cpp
M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
M Source/JavaScriptCore/runtime/JSString.cpp
M Source/JavaScriptCore/runtime/JSString.h
M Source/JavaScriptCore/runtime/JSStringInlines.h
Log Message:
-----------
[JSC] Optimize Array#indexOf in DFG / FTL
https://bugs.webkit.org/show_bug.cgi?id=246225
rdar://100907119
Reviewed by Justin Michaud and Alexey Shvayka.
This patch optimizes JetStream2/babylon-wtb up to 10%.
1. We were giving up optimization of ArrayIndexOf once we start getting BadType on the searching parameter.
But let's not do it and instead keep working with a bit more generic version since parameter type speculation
only offers a bit of performance win. So, using generic one still makes sense in terms of optimization if
type speculation failed before.
2. Add JSString::equalInline and use it in ArrayIndexOf DFG operation when we know the search parameter is JSString.
3. Add WTF::find64 optimized path for Object search in ArrayIndexOf DFG operation.
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::arrayIndexOfString):
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::argumentClampedIndexFromStartOrEnd):
* Source/JavaScriptCore/runtime/JSString.cpp:
(JSC::JSString::equalSlowCase const):
* Source/JavaScriptCore/runtime/JSString.h:
* Source/JavaScriptCore/runtime/JSStringInlines.h:
(JSC::JSString::equalInline const):
Canonical link: https://commits.webkit.org/255296@main
More information about the webkit-changes
mailing list