Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bc818abb8d4b41975712c2c6ec66bf7500753351
      
https://github.com/WebKit/WebKit/commit/bc818abb8d4b41975712c2c6ec66bf7500753351
  Author: Sosuke Suzuki <[email protected]>
  Date:   2025-10-25 (Sat, 25 Oct 2025)

  Changed paths:
    A JSTests/microbenchmarks/array-prototype-lastIndexOf-bigint.js
    A JSTests/microbenchmarks/array-prototype-lastIndexOf-contiguous.js
    A 
JSTests/microbenchmarks/array-prototype-lastIndexOf-double-from-contiguous.js
    A JSTests/microbenchmarks/array-prototype-lastIndexOf-double.js
    A 
JSTests/microbenchmarks/array-prototype-lastIndexOf-int32-from-contiguous.js
    A JSTests/microbenchmarks/array-prototype-lastIndexOf-int32.js
    A JSTests/microbenchmarks/array-prototype-lastIndexOf-string-16.js
    A JSTests/microbenchmarks/array-prototype-lastIndexOf-string-const.js
    A JSTests/microbenchmarks/array-prototype-lastIndexOf-string.js
    A JSTests/microbenchmarks/array-prototype-lastIndexOf-untyped-int32.js
    A JSTests/stress/array-prototype-lastIndexOf-doublerepuse.js
    A JSTests/stress/array-prototype-lastIndexOf-int32-from-contiguous.js
    A JSTests/stress/array-prototype-lastIndexOf-int32use.js
    A JSTests/stress/array-prototype-lastIndexOf-objectuse.js
    A JSTests/stress/array-prototype-lastIndexOf-stringuse.js
    A JSTests/stress/array-prototype-lastIndexOf-symboluse.js
    A JSTests/stress/array-prototype-lastIndexOf-untypeduse-contiguous.js
    A JSTests/stress/array-prototype-lastIndexOf-untypeduse-int32.js
    M Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/dfg/DFGClobberize.h
    M Source/JavaScriptCore/dfg/DFGDoesGC.cpp
    M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
    M Source/JavaScriptCore/dfg/DFGMayExit.cpp
    M Source/JavaScriptCore/dfg/DFGNode.h
    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/DFGSpeculativeJIT32_64.cpp
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
    M Source/JavaScriptCore/ftl/FTLCapabilities.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
    M Source/JavaScriptCore/runtime/Intrinsic.h

  Log Message:
  -----------
  [JSC] Optimize `Array#lastIndexOf` in DFG/FTL
https://bugs.webkit.org/show_bug.cgi?id=300170

Reviewed by Yusuke Suzuki.

This patch changes to optimize `Array#lastIndexOf` in DFG/FTL.

                                                  TipOfTree                  
Patched

array-prototype-lastIndexOf-string-16           0.7393+-0.0963            
0.6353+-0.0238          might be 1.1637x faster
array-prototype-lastIndexOf-double-from-contiguous
                                                0.7476+-0.3292            
0.6312+-0.0984          might be 1.1845x faster
array-prototype-lastIndexOf-int32               3.8388+-0.8260     ^      
2.3827+-0.3433        ^ definitely 1.6111x faster
array-prototype-lastIndexOf-bigint              9.9618+-0.7504     ^      
8.3997+-0.4838        ^ definitely 1.1860x faster
array-prototype-lastIndexOf-contiguous          5.4971+-1.0560     ^      
2.1412+-0.1266        ^ definitely 2.5673x faster
array-prototype-lastIndexOf-string-const        3.7607+-0.1203     ^      
2.9016+-0.1071        ^ definitely 1.2961x faster
array-prototype-lastIndexOf-untyped-int32
                                               80.1997+-0.6415     ^     
42.8832+-0.8174        ^ definitely 1.8702x faster
array-prototype-lastIndexOf-int32-from-contiguous
                                                0.6262+-0.1345            
0.6172+-0.0809          might be 1.0146x faster
array-prototype-lastIndexOf-double              2.3190+-0.0583     ^      
1.3878+-0.0684        ^ definitely 1.6711x faster
array-prototype-lastIndexOf-string              0.7423+-0.1096            
0.6556+-0.1410          might be 1.1323x faster

Tests: JSTests/microbenchmarks/array-prototype-lastIndexOf-bigint.js
       JSTests/microbenchmarks/array-prototype-lastIndexOf-contiguous.js
       
JSTests/microbenchmarks/array-prototype-lastIndexOf-double-from-contiguous.js
       JSTests/microbenchmarks/array-prototype-lastIndexOf-double.js
       
JSTests/microbenchmarks/array-prototype-lastIndexOf-int32-from-contiguous.js
       JSTests/microbenchmarks/array-prototype-lastIndexOf-int32.js
       JSTests/microbenchmarks/array-prototype-lastIndexOf-string-16.js
       JSTests/microbenchmarks/array-prototype-lastIndexOf-string-const.js
       JSTests/microbenchmarks/array-prototype-lastIndexOf-string.js
       JSTests/microbenchmarks/array-prototype-lastIndexOf-untyped-int32.js
       JSTests/stress/array-prototype-lastIndexOf-doublerepuse.js
       JSTests/stress/array-prototype-lastIndexOf-int32-from-contiguous.js
       JSTests/stress/array-prototype-lastIndexOf-int32use.js
       JSTests/stress/array-prototype-lastIndexOf-objectuse.js
       JSTests/stress/array-prototype-lastIndexOf-stringuse.js
       JSTests/stress/array-prototype-lastIndexOf-symboluse.js
       JSTests/stress/array-prototype-lastIndexOf-untypeduse-contiguous.js
       JSTests/stress/array-prototype-lastIndexOf-untypeduse-int32.js
* JSTests/microbenchmarks/array-prototype-lastIndexOf-bigint.js: Added.
* JSTests/microbenchmarks/array-prototype-lastIndexOf-contiguous.js: Added.
* 
JSTests/microbenchmarks/array-prototype-lastIndexOf-double-from-contiguous.js: 
Added.
* JSTests/microbenchmarks/array-prototype-lastIndexOf-double.js: Added.
* JSTests/microbenchmarks/array-prototype-lastIndexOf-int32-from-contiguous.js: 
Added.
* JSTests/microbenchmarks/array-prototype-lastIndexOf-int32.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-lastIndexOf-string-16.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-lastIndexOf-string-const.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-lastIndexOf-string.js: Added.
(test):
* JSTests/microbenchmarks/array-prototype-lastIndexOf-untyped-int32.js: Added.
(test):
* JSTests/stress/array-prototype-lastIndexOf-doublerepuse.js: Added.
(sameValue):
(test):
* JSTests/stress/array-prototype-lastIndexOf-int32-from-contiguous.js: Added.
(shouldBe):
* JSTests/stress/array-prototype-lastIndexOf-int32use.js: Added.
(sameValue):
(test):
* JSTests/stress/array-prototype-lastIndexOf-objectuse.js: Added.
(sameValue):
(test):
* JSTests/stress/array-prototype-lastIndexOf-stringuse.js: Added.
(sameValue):
(test):
* JSTests/stress/array-prototype-lastIndexOf-symboluse.js: Added.
(sameValue):
(test):
* JSTests/stress/array-prototype-lastIndexOf-untypeduse-contiguous.js: Added.
(sameValue):
(test):
* JSTests/stress/array-prototype-lastIndexOf-untypeduse-int32.js: Added.
(sameValue):
(test):
* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* Source/JavaScriptCore/dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::fixupArrayIndexOfOrArrayIncludes):
* Source/JavaScriptCore/dfg/DFGMayExit.cpp:
* Source/JavaScriptCore/dfg/DFGNode.h:
(JSC::DFG::Node::hasArrayMode):
* Source/JavaScriptCore/dfg/DFGNodeType.h:
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::arrayLastIndexOfString):
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
(JSC::DFG::JSC_DEFINE_NOEXCEPT_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/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* Source/JavaScriptCore/ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileArrayIndexOfOrArrayIncludes):
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::finishCreation):
* Source/JavaScriptCore/runtime/Intrinsic.h:

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



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

Reply via email to