Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 459880fdd40351501295040dd219ef965256dea9
      
https://github.com/WebKit/WebKit/commit/459880fdd40351501295040dd219ef965256dea9
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-10-07 (Wed, 07 Oct 2026)

  Changed paths:
    A JSTests/microbenchmarks/string-iterator-for-of-16bit-ascii.js
    A JSTests/stress/string-iterator-16bit-single-character.js
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

  Log Message:
  -----------
  [JSC] DFG / FTL `StringIteratorNext` should inline Latin-1 characters in 
16-bit strings
https://bugs.webkit.org/show_bug.cgi?id=326316

Reviewed by Yusuke Suzuki.

StringIteratorNext called operationStringIteratorNext for every character of a
16-bit string. A string is 16-bit as soon as it has one non-Latin-1 character,
so its ASCII characters took the slow path too.

This patch reads the character of a 16-bit string inline. If it is
maxSingleCharacterString or less, we return the cached single-character string
as we do for 8-bit strings. Larger characters still call the operation.

                                                   ToT                     
Patched

string-iterator-for-of-16bit-ascii          176.0537+-1.1032     ^     
80.7716+-5.3993        ^ definitely 2.1796x faster

Tests: JSTests/microbenchmarks/string-iterator-for-of-16bit-ascii.js
       JSTests/stress/string-iterator-16bit-single-character.js

* JSTests/microbenchmarks/string-iterator-for-of-16bit-ascii.js: Added.
(countE):
* JSTests/stress/string-iterator-16bit-single-character.js: Added.
(shouldBe):
(collect):
(collectWithNext):
(countE):
(makeRope):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compileStringIteratorNext):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):

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



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

Reply via email to