summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/smallObjectVariableKeyHasProp-3.js
blob: 84dc2bdd929a65f5ac60abdd8357e64d5a1b9e55 (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
28
29
30
31
32
33
34
let obj = {
  a: 1,
  b: 1,
  c: 1,
  [Symbol.for("foo")]: 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];
  test(key);
}

testKeys.push([Symbol.for("foo"), true]);

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