summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-post.js
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-01-21 22:29:18 +0100
committerAlon Zakai <azakai@google.com>2020-01-21 13:29:18 -0800
commit52550c26325ff3d6649fa84c83bf8d4ce9ad4fde (patch)
treee2210a0109d57a99d18ea2a0a339d809f5e6d42a /src/js/binaryen.js-post.js
parent1e79dcced11cd1da42ca0eb532ee52568c4ab2f0 (diff)
downloadbinaryen-52550c26325ff3d6649fa84c83bf8d4ce9ad4fde.tar.gz
binaryen-52550c26325ff3d6649fa84c83bf8d4ce9ad4fde.tar.bz2
binaryen-52550c26325ff3d6649fa84c83bf8d4ce9ad4fde.zip
Unify JS memory segment API (#2533)
Binaryen.js now uses offset instead of byteOffset when inspecting a memory segment, matching the arguments on memory segment creation. Also adds inspection of the passive property. Previously, one would specify { offset, data, passive } on creation and get back { byteOffset, data } upon inspection. This PR unifies both to the keys on creation while also adding the respective C-API to retrieve passive status, which was missing.
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r--src/js/binaryen.js-post.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index 54f21ed07..5857c21c9 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -2212,7 +2212,7 @@ function wrapModule(module, self) {
}
self['getMemorySegmentInfoByIndex'] = function(id) {
return {
- 'byteOffset': Module['_BinaryenGetMemorySegmentByteOffset'](module, id),
+ 'offset': Module['_BinaryenGetMemorySegmentByteOffset'](module, id),
'data': (function(){
var size = Module['_BinaryenGetMemorySegmentByteLength'](module, id);
var ptr = _malloc(size);
@@ -2221,7 +2221,8 @@ function wrapModule(module, self) {
res.set(new Uint8Array(buffer, ptr, size));
_free(ptr);
return res.buffer;
- })()
+ })(),
+ 'passive': Boolean(Module['_BinaryenGetMemorySegmentPassive'](module, id))
};
}
self['setStart'] = function(start) {