diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-24 14:07:29 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-24 14:07:29 -0800 |
commit | 823c8534b9712810bae2bd9bbe1c7f89cd062cc2 (patch) | |
tree | 83d7370c6187963fbfaf9cc7ecba61aa324005b9 /src/parseTools.js | |
parent | af99c279356f4703562633214142e4cccd558a2e (diff) |
optimize memset
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index f3ae7a22..3e361731 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1174,7 +1174,7 @@ function indexizeFunctions(value, type) { //! 'null' means, in the context of SAFE_HEAP, that we should accept all types; //! which means we should write to all slabs, ignore type differences if any on reads, etc. //! @param noNeedFirst Whether to ignore the offset in the pointer itself. -function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, sep, forcedAlign) { +function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, sep, forcedAlign, forceAsm) { if (UNALIGNED_MEMORY && !forcedAlign) align = 1; sep = sep || ';'; if (isStructType(type)) { @@ -1236,12 +1236,14 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, if (type[0] === '#') type = type.substr(1); return 'SAFE_HEAP_STORE(' + offset + ', ' + value + ', ' + type + ', ' + ((!checkSafeHeap() || ignore)|0) + ')'; } else { - return makeGetSlabs(ptr, type, true).map(function(slab) { return slab + '[' + getHeapOffset(offset, type) + ']=' + value }).join(sep); - //return '(print("set:"+(' + value + ')+":"+(' + getHeapOffset(offset, type) + ')),' + - // makeGetSlabs(ptr, type, true).map(function(slab) { return slab + '[' + getHeapOffset(offset, type) + ']=' + value }).join('; ') + ')'; + return makeGetSlabs(ptr, type, true).map(function(slab) { return slab + '[' + getHeapOffset(offset, type, forceAsm) + ']=' + value }).join(sep); } } +function makeSetValueAsm(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, sep, forcedAlign) { + return makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, sep, forcedAlign, true); +} + var SEEK_OPTIMAL_ALIGN_MIN = 20; var UNROLL_LOOP_MAX = 8; |