summaryrefslogtreecommitdiff
path: root/test/binaryen.js/emit_asmjs.js
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2017-08-24 18:31:15 +0200
committerAlon Zakai <alonzakai@gmail.com>2017-08-24 09:31:15 -0700
commitb07fafcebebab82dba46012256edc6445862cfce (patch)
treed819f110386bfe6ce3dab4aee6daeefc7f1a81ca /test/binaryen.js/emit_asmjs.js
parentac8ee6c9e7c43c80d8fb2c8166fd73f23e212069 (diff)
downloadbinaryen-b07fafcebebab82dba46012256edc6445862cfce.tar.gz
binaryen-b07fafcebebab82dba46012256edc6445862cfce.tar.bz2
binaryen-b07fafcebebab82dba46012256edc6445862cfce.zip
Initial asm.js output for binaryen-c / binaryen.js (#1136)
* Added BinaryenModulePrintAsmjs (using wasm2asm) + Module#emitAsmjs JS binding
Diffstat (limited to 'test/binaryen.js/emit_asmjs.js')
-rw-r--r--test/binaryen.js/emit_asmjs.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/binaryen.js/emit_asmjs.js b/test/binaryen.js/emit_asmjs.js
new file mode 100644
index 000000000..6848f5f01
--- /dev/null
+++ b/test/binaryen.js/emit_asmjs.js
@@ -0,0 +1,11 @@
+var module = new Binaryen.Module();
+
+var signature = module.addFunctionType("ii", Binaryen.i32, [ Binaryen.i32 ]);
+
+module.addFunction("main", signature, [], module.getLocal(0, Binaryen.i32));
+
+module.addExport("main", "main");
+
+module.validate(); // should validate before calling emitAsmjs
+
+console.log(module.emitAsmjs());