diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-08-28 14:31:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-28 14:31:08 -0700 |
commit | e06fc1414bff1085047a559eca1a8b659a20a32e (patch) | |
tree | 3fe831746d886c1d5f973b6216c7742066fb2d12 /src/tools/wasm2js.cpp | |
parent | cb0b31a2d185f18662814c9f3c9158b2eea74760 (diff) | |
download | binaryen-e06fc1414bff1085047a559eca1a8b659a20a32e.tar.gz binaryen-e06fc1414bff1085047a559eca1a8b659a20a32e.tar.bz2 binaryen-e06fc1414bff1085047a559eca1a8b659a20a32e.zip |
Allow all features on wasm2js and add atomic tests (#2311)
This adds `-all` argument to wasm2js testing and fixes wasm2js to
actually take that argument (currently it doesn't, when it takes a wast
file). This also adds a wasm2js test for `atomic.fence` instruction that
was added in #2307.
Diffstat (limited to 'src/tools/wasm2js.cpp')
-rw-r--r-- | src/tools/wasm2js.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tools/wasm2js.cpp b/src/tools/wasm2js.cpp index ebed16226..0eed845c1 100644 --- a/src/tools/wasm2js.cpp +++ b/src/tools/wasm2js.cpp @@ -517,7 +517,7 @@ public: SExpressionWasmBuilder& sexpBuilder, Output& out, Wasm2JSBuilder::Flags flags, - PassOptions options) + const ToolOptions& options) : root(root), sexpBuilder(sexpBuilder), out(out), flags(flags), options(options) {} @@ -528,7 +528,7 @@ private: SExpressionWasmBuilder& sexpBuilder; Output& out; Wasm2JSBuilder::Flags flags; - PassOptions options; + ToolOptions options; Module tempAllocationModule; Ref emitAssertReturnFunc(Builder& wasmBuilder, @@ -547,7 +547,7 @@ private: void fixCalls(Ref asmjs, Name asmModule); Ref processFunction(Function* func) { - Wasm2JSBuilder sub(flags, options); + Wasm2JSBuilder sub(flags, options.passOptions); return sub.processStandaloneFunction(&tempAllocationModule, func); } @@ -771,8 +771,9 @@ void AssertionEmitter::emit() { Name funcName(funcNameS.str().c_str()); asmModule = Name(moduleNameS.str().c_str()); Module wasm; + options.applyFeatures(wasm); SExpressionWasmBuilder builder(wasm, e); - emitWasm(wasm, out, flags, options, funcName); + emitWasm(wasm, out, flags, options.passOptions, funcName); continue; } if (!isAssertHandled(e)) { @@ -859,6 +860,7 @@ int main(int argc, const char* argv[]) { Element* root = nullptr; Module wasm; + options.applyFeatures(wasm); Ref js; std::unique_ptr<SExpressionParser> sexprParser; std::unique_ptr<SExpressionWasmBuilder> sexprBuilder; @@ -882,7 +884,6 @@ int main(int argc, const char* argv[]) { ModuleReader reader; reader.setDebug(options.debug); reader.read(input, wasm, ""); - options.applyFeatures(wasm); } else { auto input(read_file<std::vector<char>>(options.extra["infile"], Flags::Text, @@ -921,8 +922,7 @@ int main(int argc, const char* argv[]) { Flags::Text, options.debug ? Flags::Debug : Flags::Release); if (!binaryInput && options.extra["asserts"] == "1") { - AssertionEmitter(*root, *sexprBuilder, output, flags, options.passOptions) - .emit(); + AssertionEmitter(*root, *sexprBuilder, output, flags, options).emit(); } else { emitWasm(wasm, output, flags, options.passOptions, "asmFunc"); } |