diff options
author | Sam Clegg <sbc@chromium.org> | 2022-09-16 09:33:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-16 09:33:08 -0700 |
commit | d797c751df60aa5731a0cfaed1cc00811a5e273b (patch) | |
tree | cb7357ce0f6cfb25774f8565342909bb3df0210e /test/wasm2js/bulk-memory.2asm.js | |
parent | 3892b0bbe0aa0e57864e6785e43d33e89d39000b (diff) | |
download | binaryen-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/bulk-memory.2asm.js')
-rw-r--r-- | test/wasm2js/bulk-memory.2asm.js | 45 |
1 files changed, 10 insertions, 35 deletions
diff --git a/test/wasm2js/bulk-memory.2asm.js b/test/wasm2js/bulk-memory.2asm.js index 4ba96d034..3712f6a10 100644 --- a/test/wasm2js/bulk-memory.2asm.js +++ b/test/wasm2js/bulk-memory.2asm.js @@ -11,7 +11,6 @@ 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; return { @@ -19,16 +18,11 @@ function asmFunc(importObject) { }; } -var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } - }); +var retasmFunc = asmFunc({ +}); var bufferView; - var scratchBuffer = new ArrayBuffer(16); - var i32ScratchView = new Int32Array(scratchBuffer); - var f32ScratchView = new Float32Array(scratchBuffer); - var f64ScratchView = new Float64Array(scratchBuffer); - function wasm2js_memory_fill(dest, value, size) { dest = dest >>> 0; size = size >>> 0; @@ -57,7 +51,6 @@ 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($0_1, $1_1, $2) { @@ -105,8 +98,8 @@ function asmFunc(importObject) { }; } -var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } - }); +var retasmFunc = asmFunc({ +}); export var fill = retasmFunc.fill; export var load8_u = retasmFunc.load8_u; @@ -135,11 +128,6 @@ function initActiveSegments(imports) { base64DecodeToExistingUint8Array(bufferView, 0, "qrvM3Q=="); } - var scratchBuffer = new ArrayBuffer(16); - var i32ScratchView = new Int32Array(scratchBuffer); - var f32ScratchView = new Float32Array(scratchBuffer); - var f64ScratchView = new Float64Array(scratchBuffer); - function wasm2js_memory_copy(dest, source, size) { // TODO: traps on invalid things bufferView.copyWithin(dest, source, source + size); @@ -166,7 +154,6 @@ 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($0_1, $1_1, $2) { @@ -193,8 +180,8 @@ function asmFunc(importObject) { }; } -var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } - }); +var retasmFunc = asmFunc({ +}); export var copy = retasmFunc.copy; export var load8_u = retasmFunc.load8_u; @@ -222,11 +209,6 @@ export var load8_u = retasmFunc.load8_u; } memorySegments[0] = base64DecodeToExistingUint8Array(new Uint8Array(4), 0, "qrvM3Q=="); - var scratchBuffer = new ArrayBuffer(16); - var i32ScratchView = new Int32Array(scratchBuffer); - var f32ScratchView = new Float32Array(scratchBuffer); - var f64ScratchView = new Float64Array(scratchBuffer); - function wasm2js_memory_init(segment, dest, offset, size) { // TODO: traps on invalid things bufferView.set(memorySegments[segment].subarray(offset, offset + size), dest); @@ -253,7 +235,6 @@ 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($0_1, $1_1, $2) { @@ -301,8 +282,8 @@ function asmFunc(importObject) { }; } -var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } - }); +var retasmFunc = asmFunc({ +}); export var init = retasmFunc.init; export var load8_u = retasmFunc.load8_u; @@ -333,11 +314,6 @@ function initActiveSegments(imports) { base64DecodeToExistingUint8Array(bufferView, 0, ""); } - var scratchBuffer = new ArrayBuffer(16); - var i32ScratchView = new Int32Array(scratchBuffer); - var f32ScratchView = new Float32Array(scratchBuffer); - var f64ScratchView = new Float64Array(scratchBuffer); - function wasm2js_data_drop(segment) { // TODO: traps on invalid things memorySegments[segment] = new Uint8Array(0); @@ -369,7 +345,6 @@ 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() { @@ -424,8 +399,8 @@ function asmFunc(importObject) { }; } -var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); } - }); +var retasmFunc = asmFunc({ +}); export var drop_passive = retasmFunc.drop_passive; export var init_passive = retasmFunc.init_passive; export var drop_active = retasmFunc.drop_active; |