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)
50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
function simpleArith(number)
|
|
{
|
|
return (number >>> 0) + 1;
|
|
}
|
|
noInline(simpleArith);
|
|
|
|
for (let i = 0; i < 1e6; ++i) {
|
|
let simpleArithResult = simpleArith(i);
|
|
if (simpleArithResult !== i + 1)
|
|
throw "Failed simpleArith(i) at i = " + i;
|
|
|
|
simpleArithResult = simpleArith(2147483647);
|
|
if (simpleArithResult !== 2147483648)
|
|
throw "Failed simpleArith(2147483647)";
|
|
|
|
simpleArithResult = simpleArith(-1);
|
|
if (simpleArithResult !== 4294967296)
|
|
throw "Failed simpleArith(-1) at i = " + i;
|
|
}
|
|
|
|
// Make it OSR Exit.
|
|
if (simpleArith({ valueOf: function() { return 5; }}) !== 6)
|
|
throw "Failed simpleArith({ toValue: function() { return 5; }}";
|
|
if (simpleArith("WebKit!") !== 1)
|
|
throw "Failed simpleArith({ toValue: function() { return 5; }}";
|
|
|
|
|
|
function compareToLargeNumber(value)
|
|
{
|
|
return (value >>> 0) < 4294967294;
|
|
}
|
|
noInline(compareToLargeNumber);
|
|
|
|
for (let i = 0; i < 1e6; ++i) {
|
|
let compareResult = compareToLargeNumber(i);
|
|
if (compareResult !== true)
|
|
throw "Failed compareToLargeNumber(i) at i = " + i;
|
|
|
|
compareResult = compareToLargeNumber(-3);
|
|
if (compareResult !== true)
|
|
throw "Failed compareToLargeNumber(4294967293) at i = " + i;
|
|
|
|
compareResult = compareToLargeNumber(-2);
|
|
if (compareResult !== false)
|
|
throw "Failed compareToLargeNumber(4294967294) at i = " + i;
|
|
|
|
compareResult = compareToLargeNumber(-1);
|
|
if (compareResult !== false)
|
|
throw "Failed compareToLargeNumber(4294967295) at i = " + i;
|
|
} |