Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9f768a57ee202bdc619699cfdd11418f3771c91b
      
https://github.com/WebKit/WebKit/commit/9f768a57ee202bdc619699cfdd11418f3771c91b
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-01-29 (Thu, 29 Jan 2026)

  Changed paths:
    M Source/JavaScriptCore/b3/B3LowerMacros.cpp

  Log Message:
  -----------
  [JSC] Simplify B3::Switch CFG via Select
https://bugs.webkit.org/show_bug.cgi?id=306507
rdar://169163468

Reviewed by Dan Hecht.

This patch tweaks our B3::Switch lowering mechanism to make CFG simpler.
Previously we are doing this,

    if (index > tableSize) {
        ... fall through code ...
    } else
        jump jumpTable[index]

But now, we put fallthrough jump at the last of the jumpTable. And doing
so,

    index = min(index, tableSize)
    jump jumpTable[index] (jumpTable is extended to be tableSize + 1)

So if index is exceeding or same to the tableSize, it becomes the last
index, which is configured for the fallthrough.

Mainly for very large switch-table code, to make CFG simpler for easier
analysis in the other pass.

Also, we compute address loading part in B3 and patchpoint is just
focusing on farJump, to make more instructions visible to B3 compiler
(instead of making them opaque in patchpoint). Since this means we need
to get JumpTable* outside of Patchpoint, we annotate Patchpoint
"clone-forbidden". This makes sense given that this is for large switch
code.

* Source/JavaScriptCore/b3/B3LowerMacros.cpp:

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



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

Reply via email to