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

  Changed paths:
    A JSTests/stress/integer-range-optimization-arith-bit-and-or.js
    A JSTests/stress/integer-range-optimization-string-char-code-at.js
    M Source/JavaScriptCore/dfg/DFGIntegerRangeOptimizationPhase.cpp

  Log Message:
  -----------
  [JSC] Teach IntegerRangeOptimizations about a bit missing patterns
https://bugs.webkit.org/show_bug.cgi?id=313685
rdar://175885792

Reviewed by Yijia Huang.

This patch teaches IntegerRangeOptimizations with following 4 patterns.

1. StringCharCodeAt

When it is used, it is guaranteed to reutnr Int32 result (if it is
out-of-range NaN, then OSR exit happens). Thus we can say that result
range is [0, 0xffff].

2. StringCodePointAt

It is the same to (1), but it handles all Unicode code point range,
thus, the range is [0, 0x10ffff].

3. ArithBitAnd

When it is specialized with Int32Use, very likely one side is constant,
and we can narrow the range of output. Narrowing the output via one
side's constant.

4. ArithBitOr

Similar to (3), we can also do some narrowing here based on one side's constant.

Test: JSTests/stress/integer-range-optimization-arith-bit-and-or.js

* JSTests/stress/integer-range-optimization-arith-bit-and-or.js: Added.
(assert):
(bitAndIndex):
(bitAndIndexLeftConst):
(bitAndTwoMasks):
(bitAndPreserveNegative):
(bitOrWithNegative):
(bitOrZero):
(bitOrOneLeft):
(bitOrNegativeLowerBound):
(bitOrIntMin):
* JSTests/stress/integer-range-optimization-string-char-code-at.js: Added.
(assert):
(charCodeIndex):
(codePointIndex):
(charCodeLowByte):
(codePointBelowMax):
* Source/JavaScriptCore/dfg/DFGIntegerRangeOptimizationPhase.cpp:

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



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

Reply via email to