summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-post.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 /src/js/binaryen.js-post.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 'src/js/binaryen.js-post.js')
-rw-r--r--src/js/binaryen.js-post.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index cda00742c..985691494 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -833,6 +833,14 @@
Module['print'] = old;
return ret;
};
+ this['emitAsmjs'] = function() {
+ var old = Module['print'];
+ var ret = '';
+ Module['print'] = function(x) { ret += x + '\n' };
+ Module['_BinaryenModulePrintAsmjs'](module);
+ Module['print'] = old;
+ return ret;
+ };
this['validate'] = function() {
return Module['_BinaryenModuleValidate'](module);
};