blob: 9fb3c1c4a7b17ee51f87362cde469629b196299e [file] [log] [blame]
var gi;
function foo() {
if (!effectful42())
arguments = "hello";
return arguments[gi];
}
function bar(array, i) {
gi = i;
return foo.apply(this, array);
}
noInline(bar);
var bigArray = [];
for (var i = 0; i < 50; ++i)
bigArray.push(42);
for (var i = 0; i < 10000; ++i) {
var mi = i % 50;
var result = bar(bigArray, mi);
if (result !== 42)
throw "Bad result in first loop: " + result + "; expected: " + 42;
}
for (var i = 0; i < 10000; ++i) {
var mi = i % 100;
var result = bar([42], mi);
var expected = mi ? void 0 : 42;
if (result !== expected)
throw "Bad result in second loop: " + result + "; expected: " + expected;
}