aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-05-06 16:25:45 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-05-06 16:25:45 -0700
commit49387aa4de6dae35036916e0ef51a43847d7e6a8 (patch)
tree07234f0afcd4ec348492d8b9a0cf6e93f53a137a
parent875c2a297aef0e381b945e9789cc79766586832b (diff)
emit >>0 in HEAP8, for consistency with HEAP16|32
-rw-r--r--src/parseTools.js11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 4396abd9..0c413afa 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1168,15 +1168,10 @@ function getHeapOffset(offset, type, forceAsm) {
var sz = Runtime.getNativeTypeSize(type);
var shifts = Math.log(sz)/Math.LN2;
offset = '(' + offset + ')';
- if (shifts != 0) {
- if (CHECK_HEAP_ALIGN) {
- return '((CHECK_ALIGN_' + sz + '(' + offset + '|0)|0)>>' + shifts + ')';
- } else {
- return '(' + offset + '>>' + shifts + ')';
- }
+ if (CHECK_HEAP_ALIGN && shifts > 0) {
+ return '((CHECK_ALIGN_' + sz + '(' + offset + '|0)|0)>>' + shifts + ')';
} else {
- // we need to guard against overflows here, HEAP[U]8 expects a guaranteed int
- return isJSVar(offset) ? offset : '(' + offset + '|0)';
+ return '(' + offset + '>>' + shifts + ')';
}
}