mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 22:40:28 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
function opaqueModuloSmaller(a)
|
|
{
|
|
return (a % 5) % 13;
|
|
}
|
|
noInline(opaqueModuloSmaller);
|
|
|
|
function opaqueModuloEqual(a)
|
|
{
|
|
return (a % 5) % 5;
|
|
}
|
|
noInline(opaqueModuloEqual);
|
|
|
|
function opaqueModuloLarger(a)
|
|
{
|
|
return (a % 13) % 5;
|
|
}
|
|
noInline(opaqueModuloLarger);
|
|
|
|
function opaqueModuloSmallerNeg(a)
|
|
{
|
|
return (a % -5) % -13;
|
|
}
|
|
noInline(opaqueModuloSmallerNeg);
|
|
|
|
function opaqueModuloEqualNeg(a)
|
|
{
|
|
return (a % 5) % -5;
|
|
}
|
|
noInline(opaqueModuloEqualNeg);
|
|
|
|
function opaqueModuloLargerNeg(a)
|
|
{
|
|
return (a % -13) % 5;
|
|
}
|
|
noInline(opaqueModuloLargerNeg);
|
|
|
|
let testReducibleCases = [opaqueModuloSmaller, opaqueModuloEqual, opaqueModuloSmallerNeg, opaqueModuloEqualNeg];
|
|
let testOtherCases = [opaqueModuloLarger, opaqueModuloLargerNeg];
|
|
|
|
function opaqueExpectedOther(doubleInput)
|
|
{
|
|
return (doubleInput - 2147483648) % 13.0 % 5.0;
|
|
}
|
|
noInline(opaqueExpectedOther);
|
|
noDFG(opaqueExpectedOther);
|
|
|
|
// Warm up with integers. The test for NegZero should not be eliminated here.
|
|
for (let i = 1; i < 1e4; ++i) {
|
|
let excpectedReduced = i % 5;
|
|
for (let testFunction of testReducibleCases) {
|
|
let result = testFunction(i);
|
|
if (result !== excpectedReduced)
|
|
throw "" + testFunction.name + "(i), returned: " + result + " at i = " + i + " expected " + expectedOther;
|
|
}
|
|
let expectedOther = opaqueExpectedOther(i + 2147483648);
|
|
for (let testFunction of testOtherCases) {
|
|
let result = testFunction(i);
|
|
if (result !== expectedOther)
|
|
throw "" + testFunction.name + "(i), returned: " + result + " at i = " + i + " expected " + expectedOther;
|
|
}
|
|
} |