blob: 4e6009fdee58aa195f2f2a2c781c39ae9f7cbcb4 [file] [log] [blame]
//@ skip if $memoryLimited
function assert(b) {
if (!b)
throw new Error("Bad assertion.");
}
noInline(assert);
let objs = [];
let symbolPool = [];
const numSymbols = 800;
for (let i = 0; i < numSymbols; ++i)
symbolPool.push(Symbol());
for (let i = 0; i < 10000; i++) {
let num = (Math.random() * numSymbols) | 0;
let o = {};
for (let i = 0; i < num; ++i) {
o[symbolPool[i]] = 25;
}
objs.push(o);
}
function foo(o) {
let props = Object.getOwnPropertySymbols(o);
for (let i = 0; i < props.length; ++i) {
let s = props[i];
assert(o.hasOwnProperty(s));
}
}
noInline(foo);
let start = Date.now();
for (let o of objs) {
foo(o);
}