summaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-29 10:22:52 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-07 14:23:19 -0800
commit098716f2517a1536a8eab615d1ee14f9939fcec9 (patch)
treec8d7e441ab1620ea5b4a342503b0875914ed4215 /src/parseTools.js
parenta917909969156e0033286b2788f8415a0bb7f5a1 (diff)
asm.js function parameter preamble
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;
}