Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a84e1b4694055dfe89ceb1106d8850405421aa7f
https://github.com/WebKit/WebKit/commit/a84e1b4694055dfe89ceb1106d8850405421aa7f
Author: Sosuke Suzuki <[email protected]>
Date: 2026-07-18 (Sat, 18 Jul 2026)
Changed paths:
A JSTests/microbenchmarks/array-includes-string-rope-before-match.js
A JSTests/microbenchmarks/array-indexof-string-rope-before-match.js
A JSTests/stress/array-index-of-string-rope-elements-16bit.js
A JSTests/stress/array-index-of-string-rope-elements-from-index.js
A JSTests/stress/array-index-of-string-rope-elements-holes.js
A JSTests/stress/array-index-of-string-rope-elements-rescan.js
A JSTests/stress/array-index-of-string-rope-elements.js
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Log Message:
-----------
[JSC] `Array#indexOf` / `includes` should not take the slow path for rope
elements with mismatched length
https://bugs.webkit.org/show_bug.cgi?id=319237
Reviewed by Yusuke Suzuki.
A rope stores its length inline, so the fast path can compare lengths and skip
rope elements without resolving them, instead of bailing out to the slow path
at the first rope element. The slow path is now only entered when a rope's
length matches the search element. This avoids the operation call for scans
stepping over freshly created ropes, e.g. RegExp matches arrays whose captures
are substring ropes.
baseline
patched
array-indexof-string-rope-before-match 11.8110+-0.5658 ^
8.2470+-0.2127 ^ definitely 1.4322x faster
array-includes-string-rope-before-match 13.2017+-0.3347 ^
9.1412+-0.4073 ^ definitely 1.4442x faster
Tests: JSTests/microbenchmarks/array-includes-string-rope-before-match.js
JSTests/microbenchmarks/array-indexof-string-rope-before-match.js
JSTests/stress/array-index-of-string-rope-elements-16bit.js
JSTests/stress/array-index-of-string-rope-elements-from-index.js
JSTests/stress/array-index-of-string-rope-elements-holes.js
JSTests/stress/array-index-of-string-rope-elements-rescan.js
JSTests/stress/array-index-of-string-rope-elements.js
* JSTests/microbenchmarks/array-includes-string-rope-before-match.js: Added.
(makeRope):
(test):
* JSTests/microbenchmarks/array-indexof-string-rope-before-match.js: Added.
(makeRope):
(test):
* JSTests/stress/array-index-of-string-rope-elements-16bit.js: Added.
(shouldBe):
(makeRope):
(indexOfValue):
* JSTests/stress/array-index-of-string-rope-elements-from-index.js: Added.
(shouldBe):
(makeRope):
(indexOfValueFrom):
* JSTests/stress/array-index-of-string-rope-elements-holes.js: Added.
(shouldBe):
(makeRope):
(indexOfValue):
* JSTests/stress/array-index-of-string-rope-elements-rescan.js: Added.
(shouldBe):
(makeRope):
(indexOfValue):
(includesValue):
* JSTests/stress/array-index-of-string-rope-elements.js: Added.
(shouldBe):
(makeRope):
(indexOfValue):
(includesValue):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileArrayIndexOfOrArrayIncludes):
Canonical link: https://commits.webkit.org/317465@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications