summaryrefslogtreecommitdiff
path: root/test/wasm2js
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2020-11-10 18:06:14 -0800
committerGitHub <noreply@github.com>2020-11-10 18:06:14 -0800
commit32171f1d6ff57fdb31f55d8aa554eac15cb5d8f5 (patch)
tree24cdd04d3e616aa25354372a9cab2f72f95094af /test/wasm2js
parentbb124f995527f650d98bdac30b00b125b76fab9c (diff)
downloadbinaryen-32171f1d6ff57fdb31f55d8aa554eac15cb5d8f5.tar.gz
binaryen-32171f1d6ff57fdb31f55d8aa554eac15cb5d8f5.tar.bz2
binaryen-32171f1d6ff57fdb31f55d8aa554eac15cb5d8f5.zip
wasm2js: Support for exported memory (#3323)
The asmFunc now sets the outer scope's `bufferView` variable as well as its own internal views.
Diffstat (limited to 'test/wasm2js')
-rw-r--r--test/wasm2js/atomic_fence.2asm.js13
-rw-r--r--test/wasm2js/atomics_32.2asm.js13
-rw-r--r--test/wasm2js/atomics_32.2asm.js.opt13
-rw-r--r--test/wasm2js/bulk-memory.2asm.js56
-rw-r--r--test/wasm2js/bulk-memory.2asm.js.opt54
-rw-r--r--test/wasm2js/deterministic.2asm.js3
-rw-r--r--test/wasm2js/deterministic.2asm.js.opt3
-rw-r--r--test/wasm2js/dynamicLibrary.2asm.js9
-rw-r--r--test/wasm2js/dynamicLibrary.2asm.js.opt9
-rw-r--r--test/wasm2js/emscripten-grow-no.2asm.js9
-rw-r--r--test/wasm2js/emscripten-grow-no.2asm.js.opt9
-rw-r--r--test/wasm2js/emscripten-grow-yes.2asm.js13
-rw-r--r--test/wasm2js/emscripten-grow-yes.2asm.js.opt13
-rw-r--r--test/wasm2js/emscripten.2asm.js12
-rw-r--r--test/wasm2js/emscripten.2asm.js.opt12
-rw-r--r--test/wasm2js/endianness.2asm.js13
-rw-r--r--test/wasm2js/grow-memory-tricky.2asm.js13
-rw-r--r--test/wasm2js/grow-memory-tricky.2asm.js.opt13
-rw-r--r--test/wasm2js/grow_memory.2asm.js13
-rw-r--r--test/wasm2js/left-to-right.2asm.js13
-rw-r--r--test/wasm2js/minified-memory.2asm.js7
-rw-r--r--test/wasm2js/minified-memory.2asm.js.opt7
-rw-r--r--test/wasm2js/reinterpret_scratch.2asm.js11
-rw-r--r--test/wasm2js/reinterpret_scratch.2asm.js.opt11
-rw-r--r--test/wasm2js/start_func.2asm.js13
-rw-r--r--test/wasm2js/start_func.2asm.js.opt13
-rw-r--r--test/wasm2js/traps.2asm.js13
-rw-r--r--test/wasm2js/unaligned.2asm.js11
-rw-r--r--test/wasm2js/unaligned.2asm.js.opt11
29 files changed, 197 insertions, 206 deletions
diff --git a/test/wasm2js/atomic_fence.2asm.js b/test/wasm2js/atomic_fence.2asm.js
index 58945e012..7f35ea3ef 100644
--- a/test/wasm2js/atomic_fence.2asm.js
+++ b/test/wasm2js/atomic_fence.2asm.js
@@ -1,5 +1,6 @@
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(1507328);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -8,6 +9,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -37,7 +39,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -47,6 +48,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -56,10 +58,7 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(1507328);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var atomic_fence = retasmFunc.atomic_fence;
diff --git a/test/wasm2js/atomics_32.2asm.js b/test/wasm2js/atomics_32.2asm.js
index 21ee57328..99fc06a63 100644
--- a/test/wasm2js/atomics_32.2asm.js
+++ b/test/wasm2js/atomics_32.2asm.js
@@ -67,7 +67,8 @@
var memorySegments = {};
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(16777216);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -76,6 +77,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -129,8 +131,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(16777216);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
+var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
+ });
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -152,8 +155,4 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
}
memorySegments[0] = base64DecodeToExistingUint8Array(new Uint8Array(6), 0, "aGVsbG8s");
memorySegments[1] = base64DecodeToExistingUint8Array(new Uint8Array(6), 0, "d29ybGQh");
-var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
export var test = retasmFunc.test;
diff --git a/test/wasm2js/atomics_32.2asm.js.opt b/test/wasm2js/atomics_32.2asm.js.opt
index 7bb660272..24c75a1aa 100644
--- a/test/wasm2js/atomics_32.2asm.js.opt
+++ b/test/wasm2js/atomics_32.2asm.js.opt
@@ -67,7 +67,8 @@
var memorySegments = {};
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(16777216);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -76,6 +77,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -125,8 +127,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(16777216);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
+var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
+ });
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -148,8 +151,4 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
}
memorySegments[0] = base64DecodeToExistingUint8Array(new Uint8Array(6), 0, "aGVsbG8s");
memorySegments[1] = base64DecodeToExistingUint8Array(new Uint8Array(6), 0, "d29ybGQh");
-var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
export var test = retasmFunc.test;
diff --git a/test/wasm2js/bulk-memory.2asm.js b/test/wasm2js/bulk-memory.2asm.js
index 71f7168c5..b87b52d3c 100644
--- a/test/wasm2js/bulk-memory.2asm.js
+++ b/test/wasm2js/bulk-memory.2asm.js
@@ -34,7 +34,8 @@ var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
bufferView.fill(value, dest, dest + size);
}
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -43,6 +44,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -80,7 +82,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -90,6 +91,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -100,12 +102,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var fill = retasmFunc.fill;
export var load8_u = retasmFunc.load8_u;
@@ -120,7 +119,8 @@ export var load8_u = retasmFunc.load8_u;
bufferView.copyWithin(dest, source, source + size);
}
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -129,6 +129,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -164,8 +165,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
+var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
+ });
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -186,10 +188,6 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
return uint8Array;
}
base64DecodeToExistingUint8Array(bufferView, 0, "qrvM3Q==");
-var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
export var copy = retasmFunc.copy;
export var load8_u = retasmFunc.load8_u;
@@ -206,7 +204,8 @@ export var load8_u = retasmFunc.load8_u;
var memorySegments = {};
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -215,6 +214,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -252,7 +252,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -262,6 +261,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -272,8 +272,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
+var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
+ });
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -294,10 +295,6 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
return uint8Array;
}
memorySegments[0] = base64DecodeToExistingUint8Array(new Uint8Array(4), 0, "qrvM3Q==");
-var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
export var init = retasmFunc.init;
export var load8_u = retasmFunc.load8_u;
@@ -319,7 +316,8 @@ export var load8_u = retasmFunc.load8_u;
var memorySegments = {};
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -328,6 +326,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -369,7 +368,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -379,6 +377,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -391,8 +390,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
+var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
+ });
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -414,10 +414,6 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
}
memorySegments[0] = base64DecodeToExistingUint8Array(new Uint8Array(0), 0, "");
base64DecodeToExistingUint8Array(bufferView, 0, "");
-var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
export var drop_passive = retasmFunc.drop_passive;
export var init_passive = retasmFunc.init_passive;
export var drop_active = retasmFunc.drop_active;
diff --git a/test/wasm2js/bulk-memory.2asm.js.opt b/test/wasm2js/bulk-memory.2asm.js.opt
index 06fc201af..45914eaec 100644
--- a/test/wasm2js/bulk-memory.2asm.js.opt
+++ b/test/wasm2js/bulk-memory.2asm.js.opt
@@ -34,7 +34,8 @@ var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
bufferView.fill(value, dest, dest + size);
}
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -43,6 +44,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -80,7 +82,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -90,6 +91,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -100,12 +102,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var fill = retasmFunc.fill;
export var load8_u = retasmFunc.load8_u;
@@ -120,7 +119,8 @@ export var load8_u = retasmFunc.load8_u;
bufferView.copyWithin(dest, source, source + size);
}
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -129,6 +129,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -164,8 +165,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
+var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
+ });
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -186,10 +188,6 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
return uint8Array;
}
base64DecodeToExistingUint8Array(bufferView, 0, "qrvM3Q==");
-var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
export var copy = retasmFunc.copy;
export var load8_u = retasmFunc.load8_u;
@@ -206,7 +204,8 @@ export var load8_u = retasmFunc.load8_u;
var memorySegments = {};
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -215,6 +214,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -252,7 +252,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -262,6 +261,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -272,8 +272,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
+var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
+ });
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -294,14 +295,11 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
return uint8Array;
}
memorySegments[0] = base64DecodeToExistingUint8Array(new Uint8Array(4), 0, "qrvM3Q==");
-var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
export var init = retasmFunc.init;
export var load8_u = retasmFunc.load8_u;
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -310,6 +308,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -345,7 +344,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -355,6 +353,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -367,12 +366,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var drop_passive = retasmFunc.drop_passive;
export var init_passive = retasmFunc.init_passive;
export var drop_active = retasmFunc.drop_active;
diff --git a/test/wasm2js/deterministic.2asm.js b/test/wasm2js/deterministic.2asm.js
index 794633c8d..6ab4739ac 100644
--- a/test/wasm2js/deterministic.2asm.js
+++ b/test/wasm2js/deterministic.2asm.js
@@ -10,6 +10,7 @@ function asmFunc(env) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -40,8 +41,8 @@ function asmFunc(env) {
};
}
+var bufferView;
var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
memory: { buffer : memasmFunc }
});
diff --git a/test/wasm2js/deterministic.2asm.js.opt b/test/wasm2js/deterministic.2asm.js.opt
index d95a0e367..4f222ed42 100644
--- a/test/wasm2js/deterministic.2asm.js.opt
+++ b/test/wasm2js/deterministic.2asm.js.opt
@@ -10,6 +10,7 @@ function asmFunc(env) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -39,8 +40,8 @@ function asmFunc(env) {
};
}
+var bufferView;
var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
memory: { buffer : memasmFunc }
});
diff --git a/test/wasm2js/dynamicLibrary.2asm.js b/test/wasm2js/dynamicLibrary.2asm.js
index 0f91ab77e..5e743768d 100644
--- a/test/wasm2js/dynamicLibrary.2asm.js
+++ b/test/wasm2js/dynamicLibrary.2asm.js
@@ -23,6 +23,7 @@ function asmFunc(env) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -63,8 +64,11 @@ function asmFunc(env) {
};
}
+var bufferView;
var memasmFunc = new ArrayBuffer(16777216);
-var bufferView = new Uint8Array(memasmFunc);
+var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
+ memory: { buffer : memasmFunc }
+ });
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -85,7 +89,4 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
return uint8Array;
}
base64DecodeToExistingUint8Array(bufferView, memoryBase, "ZHluYW1pYyBkYXRh");
-var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
- memory: { buffer : memasmFunc }
- });
export var baz = retasmFunc.baz;
diff --git a/test/wasm2js/dynamicLibrary.2asm.js.opt b/test/wasm2js/dynamicLibrary.2asm.js.opt
index 44658694e..6c310360c 100644
--- a/test/wasm2js/dynamicLibrary.2asm.js.opt
+++ b/test/wasm2js/dynamicLibrary.2asm.js.opt
@@ -23,6 +23,7 @@ function asmFunc(env) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -55,8 +56,11 @@ function asmFunc(env) {
};
}
+var bufferView;
var memasmFunc = new ArrayBuffer(16777216);
-var bufferView = new Uint8Array(memasmFunc);
+var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
+ memory: { buffer : memasmFunc }
+ });
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -77,7 +81,4 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
return uint8Array;
}
base64DecodeToExistingUint8Array(bufferView, memoryBase, "ZHluYW1pYyBkYXRh");
-var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
- memory: { buffer : memasmFunc }
- });
export var baz = retasmFunc.baz;
diff --git a/test/wasm2js/emscripten-grow-no.2asm.js b/test/wasm2js/emscripten-grow-no.2asm.js
index 37d1b31ad..898faa539 100644
--- a/test/wasm2js/emscripten-grow-no.2asm.js
+++ b/test/wasm2js/emscripten-grow-no.2asm.js
@@ -1,4 +1,4 @@
-function instantiate(asmLibraryArg, wasmMemory) {
+function instantiate(asmLibraryArg) {
function asmFunc(env) {
var memory = env.memory;
var buffer = memory.buffer;
@@ -10,6 +10,7 @@ function asmFunc(env) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -46,7 +47,8 @@ function asmFunc(env) {
};
}
-var bufferView = new Uint8Array(wasmMemory.buffer);
+var bufferView;
+var exports = asmFunc(asmLibraryArg);
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -67,6 +69,5 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
return uint8Array;
}
base64DecodeToExistingUint8Array(bufferView, 1600, "YWJj");
-return asmFunc(asmLibraryArg, wasmMemory.buffer)
-
+return exports;
} \ No newline at end of file
diff --git a/test/wasm2js/emscripten-grow-no.2asm.js.opt b/test/wasm2js/emscripten-grow-no.2asm.js.opt
index 37d1b31ad..898faa539 100644
--- a/test/wasm2js/emscripten-grow-no.2asm.js.opt
+++ b/test/wasm2js/emscripten-grow-no.2asm.js.opt
@@ -1,4 +1,4 @@
-function instantiate(asmLibraryArg, wasmMemory) {
+function instantiate(asmLibraryArg) {
function asmFunc(env) {
var memory = env.memory;
var buffer = memory.buffer;
@@ -10,6 +10,7 @@ function asmFunc(env) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -46,7 +47,8 @@ function asmFunc(env) {
};
}
-var bufferView = new Uint8Array(wasmMemory.buffer);
+var bufferView;
+var exports = asmFunc(asmLibraryArg);
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -67,6 +69,5 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
return uint8Array;
}
base64DecodeToExistingUint8Array(bufferView, 1600, "YWJj");
-return asmFunc(asmLibraryArg, wasmMemory.buffer)
-
+return exports;
} \ No newline at end of file
diff --git a/test/wasm2js/emscripten-grow-yes.2asm.js b/test/wasm2js/emscripten-grow-yes.2asm.js
index b3cd9fa5e..7fce8936a 100644
--- a/test/wasm2js/emscripten-grow-yes.2asm.js
+++ b/test/wasm2js/emscripten-grow-yes.2asm.js
@@ -1,4 +1,4 @@
-function instantiate(asmLibraryArg, wasmMemory) {
+function instantiate(asmLibraryArg) {
function asmFunc(env) {
var memory = env.memory;
var buffer = memory.buffer;
@@ -11,6 +11,7 @@ function asmFunc(env) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -40,7 +41,6 @@ function asmFunc(env) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -50,7 +50,8 @@ function asmFunc(env) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
- memory.buffer = newBuffer;
+ memory.buffer = buffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -70,7 +71,8 @@ function asmFunc(env) {
};
}
-var bufferView = new Uint8Array(wasmMemory.buffer);
+var bufferView;
+var exports = asmFunc(asmLibraryArg);
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -91,6 +93,5 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
return uint8Array;
}
base64DecodeToExistingUint8Array(bufferView, 1600, "YWJj");
-return asmFunc(asmLibraryArg, wasmMemory.buffer)
-
+return exports;
} \ No newline at end of file
diff --git a/test/wasm2js/emscripten-grow-yes.2asm.js.opt b/test/wasm2js/emscripten-grow-yes.2asm.js.opt
index b3cd9fa5e..7fce8936a 100644
--- a/test/wasm2js/emscripten-grow-yes.2asm.js.opt
+++ b/test/wasm2js/emscripten-grow-yes.2asm.js.opt
@@ -1,4 +1,4 @@
-function instantiate(asmLibraryArg, wasmMemory) {
+function instantiate(asmLibraryArg) {
function asmFunc(env) {
var memory = env.memory;
var buffer = memory.buffer;
@@ -11,6 +11,7 @@ function asmFunc(env) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -40,7 +41,6 @@ function asmFunc(env) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -50,7 +50,8 @@ function asmFunc(env) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
- memory.buffer = newBuffer;
+ memory.buffer = buffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -70,7 +71,8 @@ function asmFunc(env) {
};
}
-var bufferView = new Uint8Array(wasmMemory.buffer);
+var bufferView;
+var exports = asmFunc(asmLibraryArg);
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -91,6 +93,5 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
return uint8Array;
}
base64DecodeToExistingUint8Array(bufferView, 1600, "YWJj");
-return asmFunc(asmLibraryArg, wasmMemory.buffer)
-
+return exports;
} \ No newline at end of file
diff --git a/test/wasm2js/emscripten.2asm.js b/test/wasm2js/emscripten.2asm.js
index 5cbb50b14..6d8a1c357 100644
--- a/test/wasm2js/emscripten.2asm.js
+++ b/test/wasm2js/emscripten.2asm.js
@@ -1,5 +1,6 @@
-function instantiate(asmLibraryArg, wasmMemory) {
-function asmFunc(env, buffer) {
+function instantiate(asmLibraryArg) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(16777216);
var FUNCTION_TABLE = env.table;
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
@@ -9,6 +10,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -203,7 +205,8 @@ function asmFunc(env, buffer) {
};
}
-var bufferView = new Uint8Array(wasmMemory.buffer);
+var bufferView;
+var exports = asmFunc(asmLibraryArg);
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -225,6 +228,5 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i
}
base64DecodeToExistingUint8Array(bufferView, 1024, "aGVsbG8sIHdvcmxkIQoAAJwMAAAtKyAgIDBYMHgAKG51bGwpAAAAAAAAAAAAAAAAEQAKABEREQAAAAAFAAAAAAAACQAAAAALAAAAAAAAAAARAA8KERERAwoHAAETCQsLAAAJBgsAAAsABhEAAAAREREAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAEQAKChEREQAKAAACAAkLAAAACQALAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAADAAAAAAJDAAAAAAADAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAANAAAABA0AAAAACQ4AAAAAAA4AAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAADwAAAAAPAAAAAAkQAAAAAAAQAAAQAAASAAAAEhISAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAASEhIAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAAKAAAAAAoAAAAACQsAAAAAAAsAAAsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAwMTIzNDU2Nzg5QUJDREVGLTBYKzBYIDBYLTB4KzB4IDB4AGluZgBJTkYAbmFuAE5BTgAuAA==");
base64DecodeToExistingUint8Array(bufferView, 1600, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=");
-return asmFunc(asmLibraryArg, wasmMemory.buffer)
-
+return exports;
} \ No newline at end of file
diff --git a/test/wasm2js/emscripten.2asm.js.opt b/test/wasm2js/emscripten.2asm.js.opt
index e055c7034..e01e4e462 100644
--- a/test/wasm2js/emscripten.2asm.js.opt
+++ b/test/wasm2js/emscripten.2asm.js.opt
@@ -1,5 +1,6 @@
-function instantiate(asmLibraryArg, wasmMemory) {
-function asmFunc(env, buffer) {
+function instantiate(asmLibraryArg) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(16777216);
var FUNCTION_TABLE = env.table;
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
@@ -9,6 +10,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -184,7 +186,8 @@ function asmFunc(env, buffer) {
};
}
-var bufferView = new Uint8Array(wasmMemory.buffer);
+var bufferView;
+var exports = asmFunc(asmLibraryArg);
for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i) {
base64ReverseLookup[48+i] = 52+i; // '0-9'
base64ReverseLookup[65+i] = i; // 'A-Z'
@@ -218,6 +221,5 @@ base64DecodeToExistingUint8Array(bufferView, 1443, "Cw==");
base64DecodeToExistingUint8Array(bufferView, 1455, "CgAAAAAKAAAAAAkLAAAAAAALAAAL");
base64DecodeToExistingUint8Array(bufferView, 1501, "DA==");
base64DecodeToExistingUint8Array(bufferView, 1513, "DAAAAAAMAAAAAAkMAAAAAAAMAAAMAAAwMTIzNDU2Nzg5QUJDREVGLTBYKzBYIDBYLTB4KzB4IDB4AGluZgBJTkYAbmFuAE5BTgAu");
-return asmFunc(asmLibraryArg, wasmMemory.buffer)
-
+return exports;
} \ No newline at end of file
diff --git a/test/wasm2js/endianness.2asm.js b/test/wasm2js/endianness.2asm.js
index 81d7f2694..c203eab2c 100644
--- a/test/wasm2js/endianness.2asm.js
+++ b/test/wasm2js/endianness.2asm.js
@@ -30,7 +30,8 @@ import { setTempRet0 } from 'env';
return f32ScratchView[2];
}
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -39,6 +40,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -662,7 +664,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -672,6 +673,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -697,13 +699,10 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
setTempRet0
- },
- memasmFunc
-);
+ });
export var i32_load16_s = retasmFunc.i32_load16_s;
export var i32_load16_u = retasmFunc.i32_load16_u;
export var i32_load = retasmFunc.i32_load;
diff --git a/test/wasm2js/grow-memory-tricky.2asm.js b/test/wasm2js/grow-memory-tricky.2asm.js
index 92d0b670a..a2049364d 100644
--- a/test/wasm2js/grow-memory-tricky.2asm.js
+++ b/test/wasm2js/grow-memory-tricky.2asm.js
@@ -1,5 +1,6 @@
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -8,6 +9,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -49,7 +51,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -59,6 +60,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -80,12 +82,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var memory = retasmFunc.memory;
export var f1 = retasmFunc.f1;
export var f2 = retasmFunc.f2;
diff --git a/test/wasm2js/grow-memory-tricky.2asm.js.opt b/test/wasm2js/grow-memory-tricky.2asm.js.opt
index 11dad89f4..e1e2d8476 100644
--- a/test/wasm2js/grow-memory-tricky.2asm.js.opt
+++ b/test/wasm2js/grow-memory-tricky.2asm.js.opt
@@ -1,5 +1,6 @@
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -8,6 +9,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -39,7 +41,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -49,6 +50,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -70,12 +72,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var memory = retasmFunc.memory;
export var f1 = retasmFunc.f1;
export var f2 = retasmFunc.f2;
diff --git a/test/wasm2js/grow_memory.2asm.js b/test/wasm2js/grow_memory.2asm.js
index 22f922a99..11c5fe3b7 100644
--- a/test/wasm2js/grow_memory.2asm.js
+++ b/test/wasm2js/grow_memory.2asm.js
@@ -1,5 +1,6 @@
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -8,6 +9,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -42,7 +44,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -52,6 +53,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -73,12 +75,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var memory = retasmFunc.memory;
export var grow = retasmFunc.grow;
export var current = retasmFunc.current;
diff --git a/test/wasm2js/left-to-right.2asm.js b/test/wasm2js/left-to-right.2asm.js
index 18a37f05b..7e066030d 100644
--- a/test/wasm2js/left-to-right.2asm.js
+++ b/test/wasm2js/left-to-right.2asm.js
@@ -25,7 +25,8 @@
f32ScratchView[2] = value;
}
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -34,6 +35,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -2051,7 +2053,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -2061,6 +2062,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -2164,12 +2166,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var i32_add = retasmFunc.i32_add;
export var i32_sub = retasmFunc.i32_sub;
export var i32_mul = retasmFunc.i32_mul;
diff --git a/test/wasm2js/minified-memory.2asm.js b/test/wasm2js/minified-memory.2asm.js
index 6c153b656..bfb5fb75c 100644
--- a/test/wasm2js/minified-memory.2asm.js
+++ b/test/wasm2js/minified-memory.2asm.js
@@ -11,6 +11,7 @@ function asmFunc(env) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -40,7 +41,6 @@ function asmFunc(env) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -50,7 +50,8 @@ function asmFunc(env) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
- memory.buffer = newBuffer;
+ memory.buffer = buffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -60,8 +61,8 @@ function asmFunc(env) {
};
}
+var bufferView;
var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
a: { buffer : memasmFunc }
});
diff --git a/test/wasm2js/minified-memory.2asm.js.opt b/test/wasm2js/minified-memory.2asm.js.opt
index c4fa180e6..9819e879a 100644
--- a/test/wasm2js/minified-memory.2asm.js.opt
+++ b/test/wasm2js/minified-memory.2asm.js.opt
@@ -11,6 +11,7 @@ function asmFunc(env) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -40,7 +41,6 @@ function asmFunc(env) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -50,7 +50,8 @@ function asmFunc(env) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
- memory.buffer = newBuffer;
+ memory.buffer = buffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -60,8 +61,8 @@ function asmFunc(env) {
};
}
+var bufferView;
var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
a: { buffer : memasmFunc }
});
diff --git a/test/wasm2js/reinterpret_scratch.2asm.js b/test/wasm2js/reinterpret_scratch.2asm.js
index 884e76c53..1d71d6613 100644
--- a/test/wasm2js/reinterpret_scratch.2asm.js
+++ b/test/wasm2js/reinterpret_scratch.2asm.js
@@ -17,7 +17,8 @@
f32ScratchView[2] = value;
}
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -26,6 +27,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -58,10 +60,7 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var foo = retasmFunc.foo;
diff --git a/test/wasm2js/reinterpret_scratch.2asm.js.opt b/test/wasm2js/reinterpret_scratch.2asm.js.opt
index 528949e9d..749279140 100644
--- a/test/wasm2js/reinterpret_scratch.2asm.js.opt
+++ b/test/wasm2js/reinterpret_scratch.2asm.js.opt
@@ -13,7 +13,8 @@
f64ScratchView[0] = value;
}
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -22,6 +23,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -53,10 +55,7 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var foo = retasmFunc.foo;
diff --git a/test/wasm2js/start_func.2asm.js b/test/wasm2js/start_func.2asm.js
index f8702ac52..70b3458fe 100644
--- a/test/wasm2js/start_func.2asm.js
+++ b/test/wasm2js/start_func.2asm.js
@@ -1,5 +1,6 @@
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -8,6 +9,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -38,7 +40,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -48,6 +49,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -57,9 +59,6 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
diff --git a/test/wasm2js/start_func.2asm.js.opt b/test/wasm2js/start_func.2asm.js.opt
index c75784973..1c624c8aa 100644
--- a/test/wasm2js/start_func.2asm.js.opt
+++ b/test/wasm2js/start_func.2asm.js.opt
@@ -1,5 +1,6 @@
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -8,6 +9,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -38,7 +40,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -48,6 +49,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -57,9 +59,6 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
diff --git a/test/wasm2js/traps.2asm.js b/test/wasm2js/traps.2asm.js
index d65bc4eb2..cca067d1c 100644
--- a/test/wasm2js/traps.2asm.js
+++ b/test/wasm2js/traps.2asm.js
@@ -1580,7 +1580,8 @@ export var no_dce_i64_trunc_f32_u = retasmFunc.no_dce_i64_trunc_f32_u;
export var no_dce_i64_trunc_f64_s = retasmFunc.no_dce_i64_trunc_f64_s;
export var no_dce_i64_trunc_f64_u = retasmFunc.no_dce_i64_trunc_f64_u;
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -1589,6 +1590,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -1690,7 +1692,6 @@ function asmFunc(env, buffer) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new Int8Array(newBuffer);
newHEAP8.set(HEAP8);
- HEAP8 = newHEAP8;
HEAP8 = new Int8Array(newBuffer);
HEAP16 = new Int16Array(newBuffer);
HEAP32 = new Int32Array(newBuffer);
@@ -1700,6 +1701,7 @@ function asmFunc(env, buffer) {
HEAPF32 = new Float32Array(newBuffer);
HEAPF64 = new Float64Array(newBuffer);
buffer = newBuffer;
+ bufferView = HEAPU8;
}
return oldPages;
}
@@ -1722,12 +1724,9 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); }
- },
- memasmFunc
-);
+ });
export var no_dce_i32_load = retasmFunc.no_dce_i32_load;
export var no_dce_i32_load16_s = retasmFunc.no_dce_i32_load16_s;
export var no_dce_i32_load16_u = retasmFunc.no_dce_i32_load16_u;
diff --git a/test/wasm2js/unaligned.2asm.js b/test/wasm2js/unaligned.2asm.js
index 2252d6950..fd6018450 100644
--- a/test/wasm2js/unaligned.2asm.js
+++ b/test/wasm2js/unaligned.2asm.js
@@ -30,7 +30,8 @@ import { setTempRet0 } from 'env';
f32ScratchView[2] = value;
}
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -39,6 +40,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -174,13 +176,10 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
setTempRet0
- },
- memasmFunc
-);
+ });
export var i32_load = retasmFunc.i32_load;
export var i64_load = retasmFunc.i64_load;
export var f32_load = retasmFunc.f32_load;
diff --git a/test/wasm2js/unaligned.2asm.js.opt b/test/wasm2js/unaligned.2asm.js.opt
index 69270c5f3..0eb08a4c7 100644
--- a/test/wasm2js/unaligned.2asm.js.opt
+++ b/test/wasm2js/unaligned.2asm.js.opt
@@ -26,7 +26,8 @@ import { setTempRet0 } from 'env';
return f32ScratchView[2];
}
-function asmFunc(env, buffer) {
+function asmFunc(env) {
+ var buffer = new ArrayBuffer(65536);
var HEAP8 = new Int8Array(buffer);
var HEAP16 = new Int16Array(buffer);
var HEAP32 = new Int32Array(buffer);
@@ -35,6 +36,7 @@ function asmFunc(env, buffer) {
var HEAPU32 = new Uint32Array(buffer);
var HEAPF32 = new Float32Array(buffer);
var HEAPF64 = new Float64Array(buffer);
+ bufferView = HEAPU8;
var Math_imul = Math.imul;
var Math_fround = Math.fround;
var Math_abs = Math.abs;
@@ -127,13 +129,10 @@ function asmFunc(env, buffer) {
};
}
-var memasmFunc = new ArrayBuffer(65536);
-var bufferView = new Uint8Array(memasmFunc);
+var bufferView;
var retasmFunc = asmFunc( { abort: function() { throw new Error('abort'); },
setTempRet0
- },
- memasmFunc
-);
+ });
export var i32_load = retasmFunc.i32_load;
export var i64_load = retasmFunc.i64_load;
export var f32_load = retasmFunc.f32_load;