test262-automation e9a5a7f918 [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) (#1620)
* [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)
2018-07-03 15:59:58 -04:00

44 lines
1.1 KiB
JavaScript

function shouldBe(actual, expected)
{
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
var array = [];
for (var i = 0; i < 100; ++i)
array.push(1024 * 1024 * 1024 * 1024 + i);
for (var i = 0; i < 100; ++i)
array.push(-(1024 * 1024 * 1024 * 1024 + i));
array.push(2251799813685248);
array.push(0.5);
function test(array, index, value)
{
return array[index] + fiatInt52(value);
}
noInline(test);
for (var i = 0; i < 1e4; ++i) {
for (var index = 0; index < 100; ++index)
shouldBe(test(array, index, 20), 1024 * 1024 * 1024 * 1024 + index + 20);
for (var index = 0; index < 100; ++index)
shouldBe(test(array, index + 100, 20), -(1024 * 1024 * 1024 * 1024 + index) + 20);
}
// Int52Overflow.
shouldBe(test(array, 200, 200), 2251799813685448);
// Not AnyIntAsDouble, Int52Overflow.
shouldBe(test(array, 201, 200), 200.5);
// Recompile the code as ArithAdd(Double, Double).
for (var i = 0; i < 1e4; ++i)
shouldBe(test(array, 201, 200), 200.5);
shouldBe(test(array, 200, 200), 2251799813685448);
shouldBe(test(array, 201, 200), 200.5);