aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-14 16:39:22 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-14 16:39:22 -0800
commite758e7cd11035424bafe92ae18645e8507fba0b2 (patch)
treeb2ab958a8a681c2ba0a99fe1952235e706d7680c
parent146687e64e9be926816dec8c9f9797f17821a543 (diff)
asm coerce the outputs of heap reads for tempDouble
-rw-r--r--src/parseTools.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 3f86172e..5f12a24f 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1041,7 +1041,7 @@ function asmMultiplyI32(a, b) {
return '(~~(+((' + a + ')|0) * +((' + b + ')|0)))';
}
-function makeGetTempDouble(i, type) { // get an aliased part of the tempDouble temporary storage
+function makeGetTempDouble(i, type, forSet) { // get an aliased part of the tempDouble temporary storage
// Cannot use makeGetValue because it uses us
// this is a unique case where we *can* use HEAPF64
var slab = type == 'double' ? 'HEAPF64' : makeGetSlabs(null, type)[0];
@@ -1053,11 +1053,13 @@ function makeGetTempDouble(i, type) { // get an aliased part of the tempDouble t
} else {
offset = getHeapOffset(ptr, type);
}
- return slab + '[' + offset + ']';
+ var ret = slab + '[' + offset + ']';
+ if (!forSet) ret = asmCoercion(ret, type);
+ return ret;
}
function makeSetTempDouble(i, type, value) {
- return makeGetTempDouble(i, type) + '=' + asmEnsureFloat(value, type);
+ return makeGetTempDouble(i, type, true) + '=' + asmEnsureFloat(value, type);
}
// See makeSetValue