Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 92626c6d115a104a3ad50e0eb1d9f2278a638fa2
      
https://github.com/WebKit/WebKit/commit/92626c6d115a104a3ad50e0eb1d9f2278a638fa2
  Author: Yusuke Suzuki <[email protected]>
  Date:   2022-10-14 (Fri, 14 Oct 2022)

  Changed paths:
    A JSTests/microbenchmarks/string-slice-constants-binary.js
    A JSTests/microbenchmarks/string-slice-constants-identity.js
    A JSTests/microbenchmarks/string-slice-constants.js
    A JSTests/microbenchmarks/string-slice-empty-constant-folding.js
    A JSTests/microbenchmarks/string-slice-length-constant.js
    A JSTests/microbenchmarks/string-slice2.js
    A JSTests/microbenchmarks/string-starts-with-mod-prototype-slice.js
    M Source/JavaScriptCore/dfg/DFGOperations.cpp
    M Source/JavaScriptCore/dfg/DFGOperations.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
    M Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/runtime/StringPrototype.cpp
    M Source/JavaScriptCore/runtime/StringPrototypeInlines.h

  Log Message:
  -----------
  [JSC] Integrate constant folding for StringSlice
https://bugs.webkit.org/show_bug.cgi?id=246433
rdar://problem/101107093

Reviewed by Alexey Shvayka.

This patch applies StringSubstring optimization to StringSlice. We add strength 
reduction for
StringSlice so that we can compute constant strings. We also enhance existing 
optimization to
capture more cases: generating empty string if from and to are the same.

                                                ToT                     Patched

string-slice-constants-binary             16.9754+-0.2657     ^     
10.8552+-0.2213        ^ definitely 1.5638x faster
string-slice-empty                         4.3653+-0.1431            
4.2705+-0.0257          might be 1.0222x faster
string-slice-constants                    17.1748+-0.2821     ^      
6.8719+-0.0946        ^ definitely 2.4993x faster
string-slice-one-char                      4.7544+-0.0539            
4.7483+-0.0480
string-slice2                             18.0453+-0.0894           
17.9867+-0.0282
string-slice-constants-identity            6.4399+-0.0305     ^      
2.9076+-0.0162        ^ definitely 2.2149x faster
string-slice-empty-constant-folding        3.7372+-0.0237     ^      
3.6572+-0.0245        ^ definitely 1.0219x faster
string-slice-length-constant              17.0568+-0.0695     ^      
6.8520+-0.0438        ^ definitely 2.4893x faster
string-slice                              13.6193+-0.0590     ?     
13.6565+-0.1618        ?

* JSTests/microbenchmarks/string-slice-constants-binary.js: Added.
(shouldBe):
(test1):
* JSTests/microbenchmarks/string-slice-constants-identity.js: Added.
(shouldBe):
(test1):
* JSTests/microbenchmarks/string-slice-constants.js: Added.
(shouldBe):
(test1):
* JSTests/microbenchmarks/string-slice-length-constant.js: Added.
(shouldBe):
(test1):
* JSTests/microbenchmarks/string-slice2.js: Added.
(shouldBe):
(test1):
* JSTests/microbenchmarks/string-starts-with-mod-prototype-slice.js: Added.
(shouldBe):
(String.prototype._startsWith):
(test1):
(test2):
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/dfg/DFGOperations.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileStringSlice):
* Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:
(JSC::DFG::StrengthReductionPhase::handleNode):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/StringPrototypeInlines.h:
(JSC::extractSliceOffsets):
(JSC::stringSlice):
(JSC::stringSubstring):

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to