blob: 8bee45ce1c728365382705d99d301ae6bcb8d87a [file] [log] [blame]
let currentArgCount;
function expectedArgCount() {
return currentArgCount;
}
noInline(expectedArgCount);
function callee() {
if (arguments.length != expectedArgCount())
throw new Error();
}
function test(array) {
callee.apply(undefined, array);
}
noInline(test);
let lengthCalls = 0;
currentArgCount = 2;
let array = { 0: 1, 1: 2, get length() { lengthCalls++; return currentArgCount } }
for (let i = 0; i < 1e5; i++)
test(array);
test(array);
currentArgCount = 100;
lengthCalls = 0;
test(array);
if (lengthCalls !== 1)
throw new Error(lengthCalls);