diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-06-19 15:08:10 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-06-19 15:20:54 -0700 |
commit | ea9efe32c9cc66bcbbdb15a1c33bf10dfbe821c5 (patch) | |
tree | 42eca8799db750aa01166d2c6640baed1db20d94 /src | |
parent | e4f8c8184058d8d621d8f3ac007a0d1a55980832 (diff) |
keep |0 on function calls, allow other bitwise ops on heap accesses etc.
Diffstat (limited to 'src')
-rw-r--r-- | src/parseTools.js | 4 | ||||
-rw-r--r-- | src/runtime.js | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 687faaa8..d54480c7 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1383,7 +1383,7 @@ function makeCopyValues(dest, src, num, type, modifier, align, sep) { if (!isNumber(num)) num = stripCorrections(num); if (!isNumber(align)) align = stripCorrections(align); if (!isNumber(num) || (parseInt(num)/align >= UNROLL_LOOP_MAX)) { - return '_memcpy(' + dest + ', ' + src + ', ' + num + ')'; + return '(_memcpy(' + dest + ', ' + src + ', ' + num + ')|0)'; } num = parseInt(num); if (ASM_JS) { @@ -1465,7 +1465,7 @@ function getFastValue(a, op, b, type) { if ((isNumber(a) && Math.abs(a) < TWO_TWENTY) || (isNumber(b) && Math.abs(b) < TWO_TWENTY) || (bits < 32 && !ASM_JS)) { return '(((' + a + ')*(' + b + '))&' + ((Math.pow(2, bits)-1)|0) + ')'; // keep a non-eliminatable coercion directly on this } - return 'Math.imul(' + a + ',' + b + ')'; + return '(Math.imul(' + a + ',' + b + ')|0)'; } } else { if (a == '0') { diff --git a/src/runtime.js b/src/runtime.js index 9bedfe68..e6d5f962 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -25,7 +25,7 @@ var RuntimeGenerator = { sep = sep || ';'; var ret = RuntimeGenerator.alloc(size, 'STACK', false, sep, USE_TYPED_ARRAYS != 2 || (isNumber(size) && parseInt(size) % {{{ STACK_ALIGN }}} == 0)); if (ASSERTIONS) { - ret += sep + 'assert(' + asmCoercion('(STACKTOP|0) < (STACK_MAX|0)', 'i32') + ')'; + ret += sep + '(assert(' + asmCoercion('(STACKTOP|0) < (STACK_MAX|0)', 'i32') + ')|0)'; } return ret; }, @@ -37,11 +37,11 @@ var RuntimeGenerator = { if (USE_TYPED_ARRAYS == 2) { assert(initial % Runtime.STACK_ALIGN == 0); if (ASSERTIONS && Runtime.STACK_ALIGN == 4) { - ret += '; assert(' + asmCoercion('!(STACKTOP&3)', 'i32') + ')'; + ret += '; (assert(' + asmCoercion('!(STACKTOP&3)', 'i32') + ')|0)'; } } if (ASSERTIONS) { - ret += '; assert(' + asmCoercion('(STACKTOP|0) < (STACK_MAX|0)', 'i32') + ')'; + ret += '; (assert(' + asmCoercion('(STACKTOP|0) < (STACK_MAX|0)', 'i32') + ')|0)'; } if (false) { ret += '; _memset(' + asmCoercion('__stackBase__', 'i32') + ', 0, ' + initial + ')'; |