blob: af9678c3c051f3e6db1c6f8a5cb10cb753d34711 [file] [log] [blame]
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
var set = new Set;
for (var i = 0; i < 100; ++i)
set.add(i);
function test(set) {
var result = 0;
for (let a of set) {
result += a;
}
return result;
}
noInline(test);
const iterationCount = $vm.useJIT() ? 1e6 : 1e4;
for (var i = 0; i < iterationCount; ++i)
shouldBe(test(set), 4950);