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/emscripten.2asm.js | |
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/emscripten.2asm.js')
-rw-r--r-- | test/wasm2js/emscripten.2asm.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/wasm2js/emscripten.2asm.js b/test/wasm2js/emscripten.2asm.js index cf9c0192e..a595eb151 100644 --- a/test/wasm2js/emscripten.2asm.js +++ b/test/wasm2js/emscripten.2asm.js @@ -204,6 +204,7 @@ function asmFunc(global, env, buffer) { }; } +var bufferView = new Uint8Array(wasmMemory.buffer); 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' @@ -221,9 +222,9 @@ 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(wasmMemory.buffer); -base64DecodeToExistingUint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