Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: be65d1a759a82e9edd0bcb80ee1637859a0eec3c
      
https://github.com/WebKit/WebKit/commit/be65d1a759a82e9edd0bcb80ee1637859a0eec3c
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-05-08 (Fri, 08 May 2026)

  Changed paths:
    A JSTests/microbenchmarks/string-equality-256-16bit.js
    A JSTests/microbenchmarks/string-equality-long-16bit.js
    A JSTests/microbenchmarks/string-equality-short-16bit.js
    A JSTests/stress/string-equality-mixed-width-slow-path.js
    A JSTests/stress/string-equality-word-compare-16bit.js
    A JSTests/stress/string-equality-word-compare-thorough.js
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

  Log Message:
  -----------
  [JSC] Inline 16-bit string equality in DFG/FTL
https://bugs.webkit.org/show_bug.cgi?id=313769

Reviewed by Yusuke Suzuki.

312326@main inlined an 8-bit string equality fast path that compares a
pointer-sized word at a time with an overlapping head load. 16-bit
strings still bailed to operationCompareStringEq, which goes through
WTF::equal and the SIMD memcmp path but eats the C call overhead.

Reuse the existing byte-addressed word/byte loop for 16-bit strings by
converting the character count into a byte count (length << 1) when both
StringImpls are 16-bit. Mixed-width pairs still bail to the runtime
helper, since the helper handles cross-width equality correctly.

The 8-bit fast path is also tightened: the two flag-bit tests are
collapsed into a single load + xor + masked test on the diff, so the
hot path costs one fewer load and one fewer mask. The FTL byte-length
phi is rarely-hinted so the 8-bit path falls through without an extra
mov on the short-string side.

                                  baseline                  patched

  string-equality-short-16bit  11.0109+-0.2215     ^      7.1928+-0.4227    ^ 
definitely 1.5308x faster
  string-equality-long-16bit   15.2884+-0.2858     ^     10.3145+-0.3964    ^ 
definitely 1.4822x faster
  string-equality-256-16bit    27.6626+-0.1356     ^     22.4260+-0.2634    ^ 
definitely 1.2335x faster

string-equality-short-8bit, string-equality-long-8bit, 
string-equality-256-8bit: unchanged from 312326@main.

Tests: JSTests/microbenchmarks/string-equality-256-16bit.js
       JSTests/microbenchmarks/string-equality-long-16bit.js
       JSTests/microbenchmarks/string-equality-short-16bit.js
       JSTests/stress/string-equality-word-compare-16bit.js
       JSTests/stress/string-equality-word-compare-thorough.js

* JSTests/microbenchmarks/string-equality-256-16bit.js: Added.
(makeString):
(eq):
* JSTests/microbenchmarks/string-equality-long-16bit.js: Added.
(makeString):
(eq):
* JSTests/microbenchmarks/string-equality-short-16bit.js: Added.
(makeString):
(eq):
* JSTests/stress/string-equality-mixed-width-slow-path.js: Added.
(eq):
* JSTests/stress/string-equality-word-compare-16bit.js: Added.
(eq):
(make):
* JSTests/stress/string-equality-word-compare-thorough.js: Added.
(eq):
(freshCopy):
(freshCopyConcat):
(const.ASCII_ALPHABET):
(const.GREEK_ALPHABET):
(makeFromAlphabet):
(flip):
(cases.push):
(freshCopy.flip):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):

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



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

Reply via email to