aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-22 09:17:49 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-29 13:01:59 -0700
commit6c137888aa150fe7ca292b969e4ffb6489230ac9 (patch)
tree2d5183498d771123af59fdf7f807e071038f9b41 /src
parentfec03aca6d36b9df1d721744af9635155c88c294 (diff)
tweak handling of unaligned doubles a little
Diffstat (limited to 'src')
-rw-r--r--src/parseTools.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 35ad014d..f46381cb 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1123,7 +1123,9 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
return '{ ' + ret.join(', ') + ' }';
}
- if (DOUBLE_MODE == 1 && USE_TYPED_ARRAYS == 2 && type == 'double' && TARGET_X86) {
+ // In double mode 1, in x86 we always assume unaligned because we can't trust that; otherwise in le32
+ // we need this code path if we are not fully aligned.
+ if (DOUBLE_MODE == 1 && USE_TYPED_ARRAYS == 2 && type == 'double' && (TARGET_X86 || align < 8)) {
return '(' + makeSetTempDouble(0, 'i32', makeGetValue(ptr, pos, 'i32', noNeedFirst, unsigned, ignore, align)) + ',' +
makeSetTempDouble(1, 'i32', makeGetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('i32')), 'i32', noNeedFirst, unsigned, ignore, align)) + ',' +
makeGetTempDouble(0, 'double') + ')';
@@ -1140,7 +1142,7 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
// Special case that we can optimize
ret += makeGetValue(ptr, pos, 'i16', noNeedFirst, 2, ignore) + '|' +
'(' + makeGetValue(ptr, getFastValue(pos, '+', 2), 'i16', noNeedFirst, 2, ignore) + '<<16)';
- } else { // XXX we cannot truly handle > 4...
+ } else { // XXX we cannot truly handle > 4... (in x86)
ret = '';
for (var i = 0; i < bytes; i++) {
ret += '(' + makeGetValue(ptr, getFastValue(pos, '+', i), 'i8', noNeedFirst, 1, ignore) + (i > 0 ? '<<' + (8*i) : '') + ')';