diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-16 12:21:42 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-16 12:21:42 -0800 |
commit | d53e12ae8e561ee1aecf76c48e2f4eff260af0d3 (patch) | |
tree | ab918d1d784f03287fb8af6a5c4ce913265836cf /src/parseTools.js | |
parent | 6f39a74b9cad5aafd53be555d8a884e480d9bedd (diff) |
allow forcing asm mode in makeGetValue, to allow library functions to use asm notation
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 3ff5e710..8fded758 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -974,7 +974,7 @@ if (ASM_JS) { var memoryMask = hexMemoryMask.length <= decMemoryMask.length ? hexMemoryMask : decMemoryMask; } -function getHeapOffset(offset, type) { +function getHeapOffset(offset, type, forceAsm) { if (USE_TYPED_ARRAYS !== 2) { return offset; } else { @@ -983,7 +983,7 @@ function getHeapOffset(offset, type) { } var shifts = Math.log(Runtime.getNativeTypeSize(type))/Math.LN2; offset = '(' + offset + ')'; - if (ASM_JS && phase == 'funcs') offset = '(' + offset + '&' + memoryMask + ')'; + if (ASM_JS && (phase == 'funcs' || forceAsm)) offset = '(' + offset + '&' + memoryMask + ')'; if (shifts != 0) { return '(' + offset + '>>' + shifts + ')'; } else { @@ -1067,7 +1067,7 @@ function makeSetTempDouble(i, type, value) { } // See makeSetValue -function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSafe) { +function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSafe, forceAsm) { if (UNALIGNED_MEMORY) align = 1; if (isStructType(type)) { var typeData = Types.types[type]; @@ -1120,7 +1120,7 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa if (type[0] === '#') type = type.substr(1); return 'SAFE_HEAP_LOAD(' + offset + ', ' + type + ', ' + (!!unsigned+0) + ', ' + ((!checkSafeHeap() || ignore)|0) + ')'; } else { - var ret = makeGetSlabs(ptr, type, false, unsigned)[0] + '[' + getHeapOffset(offset, type) + ']'; + var ret = makeGetSlabs(ptr, type, false, unsigned)[0] + '[' + getHeapOffset(offset, type, forceAsm) + ']'; if (ASM_JS && phase == 'funcs') { ret = asmCoercion(ret, type); } @@ -1128,6 +1128,10 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa } } +function makeGetValueAsm(ptr, pos, type) { + return makeGetValue(ptr, pos, type, null, null, null, null, null, true); +} + function indexizeFunctions(value, type) { assert((type && type !== '?') || (typeof value === 'string' && value.substr(0, 6) === 'CHECK_'), 'No type given for function indexizing'); assert(value !== type, 'Type set to value'); |