diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-05-02 12:04:08 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-05-02 12:04:08 -0700 |
commit | 3c63f64dd20ccabcf846d3fa0c5e06fa1bf52cc9 (patch) | |
tree | 2ca7469155bf355e40bd936c5dc02a7e13f4fa88 | |
parent | fa95b24c889a0d24b63fbde77e5a430380c6930b (diff) |
use 64-bit alignment for double writes in le32
-rw-r--r-- | src/parseTools.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 6d65a9c7..2b621833 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1235,8 +1235,7 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, return ret.join('; '); } - // TODO: optimize like get for le32 - if (DOUBLE_MODE == 1 && USE_TYPED_ARRAYS == 2 && type == 'double') { + if (DOUBLE_MODE == 1 && USE_TYPED_ARRAYS == 2 && type == 'double' && (TARGET_X86 || align < 8)) { return '(' + makeSetTempDouble(0, 'double', value) + ',' + makeSetValue(ptr, pos, makeGetTempDouble(0, 'i32'), 'i32', noNeedFirst, ignore, align, noSafe, ',') + ',' + makeSetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('i32')), makeGetTempDouble(1, 'i32'), 'i32', noNeedFirst, ignore, align, noSafe, ',') + ')'; @@ -1251,6 +1250,7 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, if (USE_TYPED_ARRAYS == 2 && (align || needSplitting)) { // Alignment is important here, or we need to split this up for other reasons. var bytes = Runtime.getNativeTypeSize(type); + if (DOUBLE_MODE == 0 && type == 'double') bytes = 4; // we will really only read 4 bytes here if (bytes > align || needSplitting) { var ret = ''; if (isIntImplemented(type)) { |