summaryrefslogtreecommitdiff
path: root/test/wasm2js/deterministic.2asm.js.opt
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2022-09-16 09:33:08 -0700
committerGitHub <noreply@github.com>2022-09-16 09:33:08 -0700
commitd797c751df60aa5731a0cfaed1cc00811a5e273b (patch)
treecb7357ce0f6cfb25774f8565342909bb3df0210e /test/wasm2js/deterministic.2asm.js.opt
parent3892b0bbe0aa0e57864e6785e43d33e89d39000b (diff)
downloadbinaryen-d797c751df60aa5731a0cfaed1cc00811a5e273b.tar.gz
binaryen-d797c751df60aa5731a0cfaed1cc00811a5e273b.tar.bz2
binaryen-d797c751df60aa5731a0cfaed1cc00811a5e273b.zip
wasm2js: Don't assume that `env.abort` can always be impored. (#5049)
This import was being injected and then used to implement trapping. Rather than injecting an import that doesn't exist in the original module we instead use the existing mechanism to implement this as an internal helper.
Diffstat (limited to 'test/wasm2js/deterministic.2asm.js.opt')
-rw-r--r--test/wasm2js/deterministic.2asm.js.opt11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/wasm2js/deterministic.2asm.js.opt b/test/wasm2js/deterministic.2asm.js.opt
index 6f6be3f85..4c9e0a139 100644
--- a/test/wasm2js/deterministic.2asm.js.opt
+++ b/test/wasm2js/deterministic.2asm.js.opt
@@ -1,4 +1,7 @@
+ var bufferView;
+function wasm2js_trap() { throw new Error('abort'); }
+
function asmFunc(importObject) {
var env = importObject.env || importObject;
var memory = env.memory;
@@ -21,16 +24,16 @@ function asmFunc(importObject) {
var Math_ceil = Math.ceil;
var Math_trunc = Math.trunc;
var Math_sqrt = Math.sqrt;
- var abort = env.abort;
var nan = NaN;
var infinity = Infinity;
function $0() {
if (4294967252 / HEAPU32[0] | 0) {
- abort()
+ wasm2js_trap()
}
return 1;
}
+ bufferView = HEAPU8;
function __wasm_memory_size() {
return buffer.byteLength / 65536 | 0;
}
@@ -41,7 +44,7 @@ function asmFunc(importObject) {
}
var memasmFunc = new ArrayBuffer(65536);
-var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
+var retasmFunc = asmFunc({
memory: { buffer : memasmFunc }
- });
+});
export var foo = retasmFunc.foo;