diff options
author | Alon Zakai <azakai@google.com> | 2020-06-22 07:00:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-22 07:00:13 -0700 |
commit | 721f15831ca547de98992f9ce6158d822b94d167 (patch) | |
tree | 6e898353d04323ff07a687dc3e4456507796feea /test/wasm2js/dynamicLibrary.2asm.js.opt | |
parent | 711f8cb0ccc0de434a86c6c704acd5a13848f4db (diff) | |
download | binaryen-721f15831ca547de98992f9ce6158d822b94d167.tar.gz binaryen-721f15831ca547de98992f9ce6158d822b94d167.tar.bz2 binaryen-721f15831ca547de98992f9ce6158d822b94d167.zip |
wasm2js: Bulk memory support (#2923)
Adds a special helper functions for data.drop etc., as unlike most
wasm instructions these are too big to emit inline.
Track passive segments at runtime in var memorySegments
whose indexes are the segment indexes.
Emit var bufferView even if the memory exists even without
memory segments, as we do still need the view in order to
operate on it.
Also adds a few constants for atomics that will be useful in future
PRs (as this PR updates the constant lists anyhow).
Diffstat (limited to 'test/wasm2js/dynamicLibrary.2asm.js.opt')
-rw-r--r-- | test/wasm2js/dynamicLibrary.2asm.js.opt | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/wasm2js/dynamicLibrary.2asm.js.opt b/test/wasm2js/dynamicLibrary.2asm.js.opt index d2e28b645..71fa441ed 100644 --- a/test/wasm2js/dynamicLibrary.2asm.js.opt +++ b/test/wasm2js/dynamicLibrary.2asm.js.opt @@ -42,6 +42,7 @@ function asmFunc(global, env, buffer) { } var memasmFunc = new ArrayBuffer(16777216); +var bufferView = new Uint8Array(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' @@ -59,8 +60,8 @@ for (var base64ReverseLookup = new Uint8Array(123/*'z'+1*/), i = 25; i >= 0; --i if (j < end) uint8Array[j++] = b1 << 4 | b2 >> 2; if (j < end) uint8Array[j++] = b2 << 6 | base64ReverseLookup[b64.charCodeAt(i+3)]; } + return uint8Array; } -var bufferView = new Uint8Array(memasmFunc); -base64DecodeToExistingUint8Array(bufferView, memoryBase, "ZHluYW1pYyBkYXRh"); + base64DecodeToExistingUint8Array(bufferView, memoryBase, "ZHluYW1pYyBkYXRh"); var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc); export var baz = retasmFunc.baz; |