<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement table-based switches in B3/Air"
   href="https://bugs.webkit.org/show_bug.cgi?id=151141">151141</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Implement table-based switches in B3/Air
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>JavaScriptCore
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>fpizlo&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>We should do this in B3::lowerMacros(). During the recursive bisecting, if we find a span of case statements that is sufficiently compact, we can optimize it down to an indirect jump.  This can be represented in B3.

- The jump table can be an opaque byproduct that will eventually hold and array of CodeLocationLabels.
- Introduce a new B3 Opcode called AwesomeJump that takes a pointer to jump to and a list of BasicBlocks that are possible successors.
- AwesomeJumps can be compiled to something equivalent in Air.
- CFG simplification ignores AwesomeJumps except when they only have one successor, in which case it can turn them into a Jump.
- A late phase can tell the byproduct holding the jump table that now is a good time to get the addresses of the BasicBlocks.  This will need some kind of hook into Air::generate().</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>