Ignore:
Timestamp:
Dec 9, 2016, 6:34:02 PM (9 years ago)
Author:
[email protected]
Message:

WebAssembly JS API: implement start function
https://bugs.webkit.org/show_bug.cgi?id=165150

Reviewed by Saam Barati.

JSTests:

  • wasm/Builder.js: allow building a .Start()
  • wasm/Builder_WebAssemblyBinary.js:
  • wasm/js-api/test_Start.js: Added.

(const.emitters.Start): serialize a start section

  • wasm/self-test/test_BuilderJSON.js: validate the start section's content

Source/JavaScriptCore:

  • wasm/WasmFormat.h: pass the start function around
  • wasm/WasmModuleParser.cpp:

(JSC::Wasm::ModuleParser::parseTable): mark unreachable code
(JSC::Wasm::ModuleParser::parseGlobal): mark unreachable code
(JSC::Wasm::ModuleParser::parseStart): mark unreachable code
(JSC::Wasm::ModuleParser::parseElement): mark unreachable code
(JSC::Wasm::ModuleParser::parseData): mark unreachable code

  • wasm/js/WebAssemblyFunction.cpp:

(JSC::callWebAssemblyFunction): NFC: call the new function below
(JSC::WebAssemblyFunction::call): separate this out so that the start function can use it

  • wasm/js/WebAssemblyFunction.h:
  • wasm/js/WebAssemblyModuleRecord.cpp:

(JSC::WebAssemblyModuleRecord::visitChildren): visit the start function
(JSC::WebAssemblyModuleRecord::link): handle start function
(JSC::WebAssemblyModuleRecord::evaluate): call the start function, if present

  • wasm/js/WebAssemblyModuleRecord.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/wasm/WasmModuleParser.cpp

    r209630 r209642  
    304304bool ModuleParser::parseTable()
    305305{
    306     // FIXME
     306    // FIXME implement table https://bugs.webkit.org/show_bug.cgi?id=164135
     307    RELEASE_ASSERT_NOT_REACHED();
    307308    return true;
    308309}
     
    366367{
    367368    // FIXME https://bugs.webkit.org/show_bug.cgi?id=164133
     369    RELEASE_ASSERT_NOT_REACHED();
    368370    return true;
    369371}
     
    416418bool ModuleParser::parseStart()
    417419{
     420    uint32_t startFunctionIndex;
     421    if (!parseVarUInt32(startFunctionIndex)
     422        || startFunctionIndex >= m_functionIndexSpace.size())
     423        return false;
     424    Signature* signature = m_functionIndexSpace[startFunctionIndex].signature;
     425    if (signature->arguments.size() != 0
     426        || signature->returnType != Void)
     427        return false;
     428    m_module->startFunctionIndexSpace = startFunctionIndex;
     429    return true;
     430}
     431
     432bool ModuleParser::parseElement()
     433{
    418434    // FIXME https://bugs.webkit.org/show_bug.cgi?id=161709
    419     return true;
    420 }
    421 
    422 bool ModuleParser::parseElement()
    423 {
    424     // FIXME https://bugs.webkit.org/show_bug.cgi?id=161709
     435    RELEASE_ASSERT_NOT_REACHED();
    425436    return true;
    426437}
     
    451462{
    452463    // FIXME https://bugs.webkit.org/show_bug.cgi?id=161709
     464    RELEASE_ASSERT_NOT_REACHED();
    453465    return true;
    454466}
Note: See TracChangeset for help on using the changeset viewer.