Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7aea7dd35f02e4dea28a15e47ee9ff486da0aeda
      
https://github.com/WebKit/WebKit/commit/7aea7dd35f02e4dea28a15e47ee9ff486da0aeda
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-04-07 (Tue, 07 Apr 2026)

  Changed paths:
    A JSTests/stress/constant-string-length-folding.js
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
    M Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

  Log Message:
  -----------
  [JSC] Fold string length as much as possible in DFG / FTL
https://bugs.webkit.org/show_bug.cgi?id=311666
rdar://174257984

Reviewed by Keith Miller and Yijia Huang.

Add helper function to fold string length as much as possible in DFG and
FTL. This potentially skips unnecessary loading or removing dead code.

Test: JSTests/stress/constant-string-length-folding.js

* JSTests/stress/constant-string-length-folding.js: Added.
(shouldBe):
(testLength):
(testCharCodeAt):
(testCodePointAt):
(testSlice):
(testAt):
(testToUpperCase):
(testToLowerCase):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileStringCodePointAt):
(JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
(JSC::DFG::SpeculativeJIT::compileGetByValOnString):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:
* Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:
(JSC::DFG::StrengthReductionPhase::handleNode):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileGetArrayLength):
(JSC::FTL::DFG::LowerDFGToB3::compileStringCharAtImpl):
(JSC::FTL::DFG::LowerDFGToB3::compileStringCharCodeAt):
(JSC::FTL::DFG::LowerDFGToB3::compileStringCodePointAt):
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):

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



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

Reply via email to