summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/smallObjectVariableKeyHasProp-1.js
blob: aa213b375f38912909b472f1cd314081f7ece10e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
let obj = {
  a: 1,
  b: 1,
  c: 1,
};

function test(id) {
  return Object.hasOwn(obj, id);
}

let testKeys = [
  ["a", true],
  ["b", true],
  ["c", true],
  ["d", false],
  ["e", false],
  ["f", false],
  ["g", false],
  ["h", false],
];

with({});

for (var i = 0; i < 1000; i++) {
  let [key, has] = testKeys[i % testKeys.length];
  assertEq(test(key), has);
}