Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1f7d7d5a8c2357656d17d4d6474b9cc3b38423b1
https://github.com/WebKit/WebKit/commit/1f7d7d5a8c2357656d17d4d6474b9cc3b38423b1
Author: Sosuke Suzuki <[email protected]>
Date: 2026-01-27 (Tue, 27 Jan 2026)
Changed paths:
A JSTests/microbenchmarks/string-prototype-startswith-constant-folding.js
A JSTests/microbenchmarks/string-prototype-startswith-with-index.js
A JSTests/microbenchmarks/string-prototype-startswith-with-one-char.js
A JSTests/microbenchmarks/string-prototype-startswith.js
A JSTests/stress/string-prototype-startswith-coerced-position.js
A JSTests/stress/string-prototype-startswith-constant-folding.js
A JSTests/stress/string-prototype-startswith-rope.js
A JSTests/stress/string-prototype-startswith-search-coercion.js
A JSTests/stress/string-prototype-startswith-unicode.js
A JSTests/stress/string-prototype-startswith-with-index.js
A JSTests/stress/string-prototype-startswith.js
M Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
M Source/JavaScriptCore/dfg/DFGBackwardsPropagationPhase.cpp
M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
M Source/JavaScriptCore/dfg/DFGClobberize.h
M Source/JavaScriptCore/dfg/DFGCloneHelper.h
M Source/JavaScriptCore/dfg/DFGDoesGC.cpp
M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
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/DFGSafeToExecute.h
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
M Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
M Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp
M Source/JavaScriptCore/ftl/FTLCapabilities.cpp
M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
M Source/JavaScriptCore/runtime/Intrinsic.h
M Source/JavaScriptCore/runtime/StringPrototype.cpp
Log Message:
-----------
[JSC] Optimize `String#startsWith` in DFG/FTL
https://bugs.webkit.org/show_bug.cgi?id=304932
Reviewed by Yusuke Suzuki.
This patch changes to optimize `String#startsWith` in DFG/FTL.
TipOfTree
Patched
string-prototype-startswith 22.6393+-0.3554 ^
15.9425+-0.8382 ^ definitely 1.4201x faster
string-prototype-startswith-constant-folding
34.3708+-1.4274 ^
5.9707+-0.6009 ^ definitely 5.7566x faster
string-prototype-startswith-with-index 34.9549+-2.0886 ^
28.5803+-2.2877 ^ definitely 1.2230x faster
string-prototype-startswith-with-one-char
24.2620+-12.1058
12.8071+-0.3200 might be 1.8944x faster
Tests: JSTests/microbenchmarks/string-prototype-startswith-constant-folding.js
JSTests/microbenchmarks/string-prototype-startswith-with-index.js
JSTests/microbenchmarks/string-prototype-startswith-with-one-char.js
JSTests/microbenchmarks/string-prototype-startswith.js
JSTests/stress/string-prototype-startswith-coerced-position.js
JSTests/stress/string-prototype-startswith-constant-folding.js
JSTests/stress/string-prototype-startswith-rope.js
JSTests/stress/string-prototype-startswith-search-coercion.js
JSTests/stress/string-prototype-startswith-unicode.js
JSTests/stress/string-prototype-startswith-with-index.js
JSTests/stress/string-prototype-startswith.js
* JSTests/microbenchmarks/string-prototype-startswith-constant-folding.js:
Added.
(testConstantFound):
(testConstantNotFound):
(testConstantWithIndex):
(testConstantOneChar):
(testConstantOneCharWithIndex):
* JSTests/microbenchmarks/string-prototype-startswith-with-index.js: Added.
(test):
(makeString):
* JSTests/microbenchmarks/string-prototype-startswith-with-one-char.js: Added.
(test):
(makeString):
* JSTests/microbenchmarks/string-prototype-startswith.js: Added.
(test):
(makeString):
* JSTests/stress/string-prototype-startswith-coerced-position.js: Added.
(shouldBe):
(test):
(makeString):
(i.valueOf):
(i.toString):
* JSTests/stress/string-prototype-startswith-constant-folding.js: Added.
(shouldBe):
(testConstantFound):
(testConstantNotFound):
(testConstantWithIndex):
(testConstantWithIndexNotFound):
(testConstantOneChar):
(testConstantOneCharNotFound):
(testConstantOneCharWithIndex):
(testConstantOneCharWithIndexNotFound):
(testEmptySearch):
(testEmptySearchWithIndex):
* JSTests/stress/string-prototype-startswith-rope.js: Added.
(shouldBe):
(test):
(testWithIndex):
(makeRope):
(makeRope3):
* JSTests/stress/string-prototype-startswith-search-coercion.js: Added.
(shouldBe):
(shouldThrow):
(test):
(testWithIndex):
(makeString):
(i.objWithToString.toString):
(i.objWithValueOf.valueOf):
(i.objWithValueOf.toString):
(i.shouldThrow):
* JSTests/stress/string-prototype-startswith-unicode.js: Added.
(shouldBe):
(test):
(testWithIndex):
(makeString):
* JSTests/stress/string-prototype-startswith-with-index.js: Added.
(shouldBe):
(test):
(makeString):
* JSTests/stress/string-prototype-startswith.js: Added.
(shouldBe):
(test):
(makeString):
* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* Source/JavaScriptCore/dfg/DFGBackwardsPropagationPhase.cpp:
(JSC::DFG::BackwardsPropagationPhase::propagate):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* Source/JavaScriptCore/dfg/DFGCloneHelper.h:
* Source/JavaScriptCore/dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* 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/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:
(JSC::DFG::StrengthReductionPhase::handleNode):
* Source/JavaScriptCore/ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileStringStartsWith):
* Source/JavaScriptCore/runtime/Intrinsic.h:
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):
Canonical link: https://commits.webkit.org/306324@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications