Bug 149051 - Implement switch statements in WebAssembly
Summary: Implement switch statements in WebAssembly
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 146064
  Show dependency treegraph
 
Reported: 2015-09-10 17:02 PDT by Sukolsak Sakshuwong
Modified: 2015-09-10 18:37 PDT (History)
4 users (show)

See Also:


Attachments
Patch (8.58 KB, patch)
2015-09-10 17:13 PDT, Sukolsak Sakshuwong
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sukolsak Sakshuwong 2015-09-10 17:02:39 PDT
Implement switch statements in WebAssembly
Comment 1 Sukolsak Sakshuwong 2015-09-10 17:13:19 PDT
Created attachment 260972 [details]
Patch
Comment 2 Sukolsak Sakshuwong 2015-09-10 17:18:42 PDT
Here's what buildSwitch() in the LLVM IR generator will look like:

void buildSwitch(LValue expression, const Vector<int64_t>& cases, const Vector<LBasicBlock>& targets, LBasicBlock defaultTarget)
{
    Vector<FTL::SwitchCase> switchCases;
    switchCases.reserveInitialCapacity(cases.size());
    for (size_t i = 0; i < cases.size(); ++i)
        switchCases.uncheckedAppend(FTL::SwitchCase(m_out.constInt32(static_cast<int32_t>(cases[i])), targets[i]));
    m_out.switchInstruction(expression, switchCases, defaultTarget, FTL::Weight());
}
Comment 3 Geoffrey Garen 2015-09-10 17:48:20 PDT
Comment on attachment 260972 [details]
Patch

r=me
Comment 4 WebKit Commit Bot 2015-09-10 18:37:20 PDT
Comment on attachment 260972 [details]
Patch

Clearing flags on attachment: 260972

Committed r189599: <http://trac.webkit.org/changeset/189599>
Comment 5 WebKit Commit Bot 2015-09-10 18:37:24 PDT
All reviewed patches have been landed.  Closing bug.