Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 901865149859cae66bd836c2f2e4f0524cd9adf7
      
https://github.com/WebKit/WebKit/commit/901865149859cae66bd836c2f2e4f0524cd9adf7
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-02-06 (Fri, 06 Feb 2026)

  Changed paths:
    A JSTests/microbenchmarks/string-prototype-endswith-constant-folding.js
    A JSTests/microbenchmarks/string-prototype-endswith-with-index.js
    A JSTests/microbenchmarks/string-prototype-endswith-with-one-char.js
    A JSTests/microbenchmarks/string-prototype-endswith.js
    A JSTests/stress/string-prototype-endswith-coerced-position.js
    A JSTests/stress/string-prototype-endswith-constant-folding.js
    A JSTests/stress/string-prototype-endswith-rope.js
    A JSTests/stress/string-prototype-endswith-search-coercion.js
    A JSTests/stress/string-prototype-endswith-unicode.js
    A JSTests/stress/string-prototype-endswith-with-index.js
    A JSTests/stress/string-prototype-endswith.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#endsWith` in DFG/FTL
https://bugs.webkit.org/show_bug.cgi?id=306410

Reviewed by Yusuke Suzuki.

This patch changes to optimize `String#endsWith` in DFG/FTL.

                                                  TipOfTree                  
Patched

string-prototype-endswith-constant-folding
                                               56.8176+-21.9201    ^      
5.3935+-0.4238        ^ definitely 10.5345x faster
string-prototype-endswith-with-index           45.2050+-13.0423          
40.9865+-10.1781         might be 1.1029x faster
string-prototype-endswith-with-one-char        27.4311+-12.0414          
17.6594+-5.6997          might be 1.5533x faster
string-prototype-endswith                      25.0453+-1.0958     ^     
17.3048+-1.2104        ^ definitely 1.4473x faster

Tests: JSTests/microbenchmarks/string-prototype-endswith-constant-folding.js
       JSTests/microbenchmarks/string-prototype-endswith-with-index.js
       JSTests/microbenchmarks/string-prototype-endswith-with-one-char.js
       JSTests/microbenchmarks/string-prototype-endswith.js
       JSTests/stress/string-prototype-endswith-coerced-position.js
       JSTests/stress/string-prototype-endswith-constant-folding.js
       JSTests/stress/string-prototype-endswith-rope.js
       JSTests/stress/string-prototype-endswith-search-coercion.js
       JSTests/stress/string-prototype-endswith-unicode.js
       JSTests/stress/string-prototype-endswith-with-index.js
       JSTests/stress/string-prototype-endswith.js

* JSTests/microbenchmarks/string-prototype-endswith-constant-folding.js: Added.
(testConstantFound):
(testConstantNotFound):
(testConstantWithEndPosition):
(testConstantOneChar):
(testConstantOneCharWithEndPosition):
* JSTests/microbenchmarks/string-prototype-endswith-with-index.js: Added.
(test):
(makeString):
* JSTests/microbenchmarks/string-prototype-endswith-with-one-char.js: Added.
(test):
(makeString):
* JSTests/microbenchmarks/string-prototype-endswith.js: Added.
(test):
(makeString):
* JSTests/stress/string-prototype-endswith-coerced-position.js: Added.
(shouldBe):
(test):
(makeString):
(i.valueOf):
(i.toString):
* JSTests/stress/string-prototype-endswith-constant-folding.js: Added.
(shouldBe):
(testConstantFound):
(testConstantNotFound):
(testConstantWithEndPosition):
(testConstantWithEndPositionNotFound):
(testConstantOneChar):
(testConstantOneCharNotFound):
(testConstantOneCharWithEndPosition):
(testConstantOneCharWithEndPositionNotFound):
(testEmptySearch):
(testEmptySearchWithEndPosition):
* JSTests/stress/string-prototype-endswith-rope.js: Added.
(shouldBe):
(test):
(testWithEndPosition):
(makeRope):
(makeRope3):
* JSTests/stress/string-prototype-endswith-search-coercion.js: Added.
(shouldBe):
(shouldThrow):
(test):
(testWithEndPosition):
(makeString):
(i.objWithToString.toString):
(i.objWithValueOf.valueOf):
(i.objWithValueOf.toString):
(i.shouldThrow):
* JSTests/stress/string-prototype-endswith-unicode.js: Added.
(shouldBe):
(test):
(testWithEndPosition):
(makeString):
* JSTests/stress/string-prototype-endswith-with-index.js: Added.
(shouldBe):
(test):
(makeString):
* JSTests/stress/string-prototype-endswith.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::compileStringEndsWith):
* Source/JavaScriptCore/runtime/Intrinsic.h:
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):

Canonical link: https://commits.webkit.org/306937@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to