<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement switch statements in WebAssembly"
   href="https://bugs.webkit.org/show_bug.cgi?id=149051#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Implement switch statements in WebAssembly"
   href="https://bugs.webkit.org/show_bug.cgi?id=149051">bug 149051</a>
              from <span class="vcard"><a class="email" href="mailto:sukolsak&#64;gmail.com" title="Sukolsak Sakshuwong &lt;sukolsak&#64;gmail.com&gt;"> <span class="fn">Sukolsak Sakshuwong</span></a>
</span></b>
        <pre>Here's what buildSwitch() in the LLVM IR generator will look like:

void buildSwitch(LValue expression, const Vector&lt;int64_t&gt;&amp; cases, const Vector&lt;LBasicBlock&gt;&amp; targets, LBasicBlock defaultTarget)
{
    Vector&lt;FTL::SwitchCase&gt; switchCases;
    switchCases.reserveInitialCapacity(cases.size());
    for (size_t i = 0; i &lt; cases.size(); ++i)
        switchCases.uncheckedAppend(FTL::SwitchCase(m_out.constInt32(static_cast&lt;int32_t&gt;(cases[i])), targets[i]));
    m_out.switchInstruction(expression, switchCases, defaultTarget, FTL::Weight());
}</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>