diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-28 11:15:12 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-28 11:15:12 -0800 |
commit | 19acb40b4c25ad93056e88b276d9d04079e28b1e (patch) | |
tree | d80c1fa29bde5324ec98e32f09b644ad13833436 /src/parseTools.js | |
parent | 4e659b53221f744fcd27d2f049b205e97f9ed120 (diff) |
make safe heap work in asm
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index bace60db..994e391b 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1131,7 +1131,7 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa if (SAFE_HEAP && !noSafe) { if (type !== 'null' && type[0] !== '#') type = '"' + safeQuote(type) + '"'; if (type[0] === '#') type = type.substr(1); - return 'SAFE_HEAP_LOAD(' + offset + ', ' + type + ', ' + (!!unsigned+0) + ', ' + ((!checkSafeHeap() || ignore)|0) + ')'; + return 'SAFE_HEAP_LOAD(' + asmCoercion(offset, 'i32') + ', ' + (ASM_JS ? 0 : type) + ', ' + (!!unsigned+0) + ', ' + ((!checkSafeHeap() || ignore)|0) + ')'; } else { var ret = makeGetSlabs(ptr, type, false, unsigned)[0] + '[' + getHeapOffset(offset, type, forceAsm) + ']'; if (ASM_JS && phase == 'funcs') { @@ -1234,7 +1234,7 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, if (SAFE_HEAP && !noSafe) { if (type !== 'null' && type[0] !== '#') type = '"' + safeQuote(type) + '"'; if (type[0] === '#') type = type.substr(1); - return 'SAFE_HEAP_STORE(' + offset + ', ' + value + ', ' + type + ', ' + ((!checkSafeHeap() || ignore)|0) + ')'; + return 'SAFE_HEAP_STORE(' + asmCoercion(offset, 'i32') + ', ' + asmCoercion(value, type) + ', ' + (ASM_JS ? 0 : type) + ', ' + ((!checkSafeHeap() || ignore)|0) + ')'; } else { return makeGetSlabs(ptr, type, true).map(function(slab) { return slab + '[' + getHeapOffset(offset, type, forceAsm) + ']=' + value }).join(sep); } |