This commit is contained in:
Alon Zakai 2013-01-23 16:48:49 -08:00
Родитель ab20c69e04
Коммит f23a99a624
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -413,7 +413,7 @@ var asm = (function(global, env, buffer) {
''' % (asm_setup,) + '\n' + asm_global_vars + '''
var __THREW__ = 0;
var undef = 0;
var tempInt = 0, tempBigInt = 0, tempBigIntP = 0, tempBigIntS = 0, tempBigIntR = 0.0, tempBigIntI = 0, tempBigIntD = 0, tempValue = 0;
var tempInt = 0, tempBigInt = 0, tempBigIntP = 0, tempBigIntS = 0, tempBigIntR = 0.0, tempBigIntI = 0, tempBigIntD = 0, tempValue = 0, tempDouble = 0.0;
''' + ''.join(['''
var tempRet%d = 0;''' % i for i in range(10)]) + '\n' + asm_global_funcs + '''
function stackAlloc(size) {

Просмотреть файл

@ -1892,6 +1892,11 @@ function makeRounding(value, bits, signed, floatConversion) {
}
}
function makeIsNaN(value) {
if (ASM_JS) return makeInlineCalculation('((VALUE) != (VALUE))', value, 'tempDouble');
return 'isNaN(' + value + ')';
}
// fptoui and fptosi are not in these, because we need to be careful about what we do there. We can't
// just sign/unsign the input first.
var UNSIGNED_OP = set('udiv', 'urem', 'uitofp', 'zext', 'lshr');
@ -2208,8 +2213,8 @@ function processMathop(item) {
case 'ult': case 'olt': return idents[0] + ' < ' + idents[1];
case 'une': case 'one': return idents[0] + ' != ' + idents[1];
case 'ueq': case 'oeq': return idents[0] + ' == ' + idents[1];
case 'ord': return '!isNaN(' + idents[0] + ') && !isNaN(' + idents[1] + ')';
case 'uno': return 'isNaN(' + idents[0] + ') || isNaN(' + idents[1] + ')';
case 'ord': return '!' + makeIsNaN(idents[0]) + ' & !' + makeIsNaN(idents[1]);
case 'uno': return makeIsNaN(idents[0]) + ' | ' + makeIsNaN(idents[1]);
case 'true': return '1';
default: throw 'Unknown fcmp variant: ' + variant;
}