Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 237fbbea10ddcb1c5aea2a03ecf16c900893eea7
      
https://github.com/WebKit/WebKit/commit/237fbbea10ddcb1c5aea2a03ecf16c900893eea7
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-05-11 (Mon, 11 May 2026)

  Changed paths:
    A JSTests/stress/arith-mod-before-narrow-typed-array-store.js
    M Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp

  Log Message:
  -----------
  [JSC] Add strength reduction skipping ArithMod
https://bugs.webkit.org/show_bug.cgi?id=314473
rdar://176645380

Reviewed by Yijia Huang.

When we have a code like,

PutByVal(Int8Array, ArithMod(Int32Use:x, 256))

This can be converted to PutByVal(Int8Array, Int32Use:x) because
ArithMod 256 just extract lower 8bit and Int8Array store will just move
this 8bit representation to the array. This is the same to Uint8Array,
Int16Array, Uint16Array. This patch adds strength reduction rule to DFG
for this, which can skip ArithMod.

Test: JSTests/stress/arith-mod-before-narrow-typed-array-store.js

* JSTests/stress/arith-mod-before-narrow-typed-array-store.js: Added.
(uint8StoreMod):
(int8StoreMod):
(uint16StoreMod):
(int16StoreMod):
(uint8StoreModMultiple):
(uint8StoreNegativeMod):
(uint8StoreSmallMod):
(clampedStoreMod):
(toUint8):
(toInt8):
(toUint16):
(toInt16):
(toUint8Clamped):
(check):
(fillUint8):
(sharedMod):
(uint8StoreUnsignedShiftMod):
(uint8StoreNestedMod):
(uint8StoreModOverUnsignedShift):
* Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:
(JSC::DFG::StrengthReductionPhase::handleNode):

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



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

Reply via email to