Bug 1059606: Take into account that coerced math builtin calls can be in deadCode; r=luke

--HG--
extra : rebase_source : 2017251dd162966e01a8047d8840301d7c427106
This commit is contained in:
Benjamin Bouvier 2014-08-28 21:46:28 +02:00
Родитель 362c5a201f
Коммит 38e9d185a3
2 изменённых файлов: 4 добавлений и 2 удалений

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

@ -4127,8 +4127,8 @@ CheckCoercedMathBuiltinCall(FunctionCompiler &f, ParseNode *callNode, AsmJSMathB
break;
}
JS_ASSERT_IF(retType == RetType::Void, !*def);
JS_ASSERT_IF(retType != RetType::Void, !!*def);
JS_ASSERT_IF(retType == RetType::Void || f.inDeadCode(), !*def);
JS_ASSERT_IF(retType != RetType::Void && !f.inDeadCode(), !!*def);
return true;
}

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

@ -153,6 +153,8 @@ assertEq(asmLink(asmCompile('glob', USE_ASM + 'var max=glob.Math.max; function f
assertEq(asmLink(asmCompile('glob', USE_ASM + 'var min=glob.Math.min; function f(d) { d=+d; var i=0; i = ~~min(d, 0.)|0; return i|0 } return f'), this)(-42), -42);
assertEq(asmLink(asmCompile('glob', USE_ASM + 'var max=glob.Math.max; function f(d) { d=+d; var i=0; i = ~~max(d, 0.)|0; return i|0 } return f'), this)(-42), 0);
assertEq(asmLink(asmCompile('glob', USE_ASM + 'var abs=glob.Math.abs; function f(i) { i=i|0; var d=0.0; return +d; +abs(i|0); return 3.0;} return f'), this)(-42), 0);
assertAsmTypeFail('glob', USE_ASM + 'var tau=glob.Math.TAU; function f() {} return f');
assertAsmTypeFail('glob', USE_ASM + 'var pi=glob.Math.PI; function f() { return pi | 0 } return f');
assertAsmTypeFail('glob', USE_ASM + 'var pi=glob.Math.PI; function f() { return +pi() } return f');