Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 27eb122967d3188a3ea63a018bcff533df3d88e0
https://github.com/WebKit/WebKit/commit/27eb122967d3188a3ea63a018bcff533df3d88e0
Author: Yusuke Suzuki <[email protected]>
Date: 2026-08-31 (Mon, 31 Aug 2026)
Changed paths:
A JSTests/stress/string-index-of-search-longer-than-subject.js
A JSTests/stress/string-last-index-of-search-longer-than-subject.js
M Source/JavaScriptCore/dfg/DFGOperations.cpp
M Source/JavaScriptCore/runtime/StringPrototype.cpp
M Source/WTF/wtf/text/StringView.cpp
Log Message:
-----------
[JSC] Reject when search-string is longer than the target-string early
https://bugs.webkit.org/show_bug.cgi?id=322924
rdar://186187306
Reviewed by Marcus Plutowski.
For String#indexOf / String#includes / StringView::find, reject when
search-string is longer than the target-string early before constructing
adaptive string searcher table. We apply the same thing to reverseFind /
lastIndexOf etc. Also doing the same fast path rejection for startsWith
and endsWith.
Test: JSTests/stress/string-index-of-search-longer-than-subject.js
* JSTests/stress/string-index-of-search-longer-than-subject.js: Added.
(shouldBe):
(indexOf):
(indexOfAt):
(includes):
(includesAt):
(referenceIndexOf):
(indexOfRope):
* JSTests/stress/string-last-index-of-search-longer-than-subject.js: Added.
(shouldBe):
(lastIndexOf):
(lastIndexOfAt):
(startsWith):
(startsWithAt):
(endsWith):
(endsWithAt):
(matchesAt):
(referenceLastIndexOf):
(referenceStartsWith):
(referenceEndsWith):
(lastIndexOfRopeSubject):
(startsWithRopeSubject):
(endsWithRopeSubject):
(lastIndexOfRopeSearch):
(startsWithRopeSearch):
(endsWithRopeSearch):
(lastIndexOfRopeSubjectAt):
(map):
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::stringIncludesImpl):
* Source/WTF/wtf/text/StringView.cpp:
(WTF::StringView::find const):
Canonical link: https://commits.webkit.org/320177@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications