aboutsummaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/parseTools.js')
-rw-r--r--src/parseTools.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 0a86abc1..7a8637a0 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -930,6 +930,7 @@ if (ASM_JS) {
var decMemoryMask = (TOTAL_MEMORY-1).toString();
var memoryMask = hexMemoryMask.length <= decMemoryMask.length ? hexMemoryMask : decMemoryMask;
}
+
function getHeapOffset(offset, type) {
if (USE_TYPED_ARRAYS !== 2) {
return offset;
@@ -948,6 +949,14 @@ function getHeapOffset(offset, type) {
}
}
+function asmCoercion(value, type) {
+ if (type in Runtime.INT_TYPES) {
+ return value + '|0';
+ } else {
+ return '+' + value;
+ }
+}
+
// See makeSetValue
function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSafe) {
noticePtr(ptr);
@@ -1005,11 +1014,7 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
} else {
var ret = makeGetSlabs(ptr, type, false, unsigned)[0] + '[' + getHeapOffset(offset, type) + ']';
if (ASM_JS && phase == 'funcs') {
- if (type in Runtime.INT_TYPES) {
- ret = ret + '|0';
- } else {
- ret = '+' + ret;
- }
+ ret = asmCoercion(ret, type);
}
return ret;
}