test262/implementation-contributed/javascriptcore/stress/folding-get-by-val-with-immutable-butterfly.js
test262-automation 24f861721f [javascriptcore-test262-automation] Updated curation log with latest revision sha's from export and changed files.
sourceRevisionAtLastExport: 8bfa53d50 targetRevisionAtLastExport: 8bc4e38a
2018-07-29 23:55:12 -04:00

31 lines
567 B
JavaScript

function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
var array = [1, 2, 3, 4, 5];
function checking(i)
{
if (i === (1e6 - 1)) {
// array[0] = 42;
array.ok = 4000;
} else if (i === (2e6 - 4000)) {
array.hey = 4000;
} else if (i === (1e6 * 2)) {
array[0] = 42;
}
}
noInline(checking);
function test(i)
{
checking(i);
return array[0] + array[1];
}
noInline(test);
for (var i = 0; i < 2e6; ++i)
shouldBe(test(i), 3);
shouldBe(test(2e6), 44);