summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/cacheir/has-undefined-null.js
blob: 7f0109a5c1a7eedf470be15b36e59cba7fc86813 (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
function exists() {
  var a = {'null': 0, 'undefined': 0};
  for (var i = 0; i < 100; i++) {
    assertEq(null in a, true);
    assertEq(undefined in a, true);
  }
}

function missing() {
  var a = {};
  for (var i = 0; i < 100; i++) {
    assertEq(null in a, false);
    assertEq(undefined in a, false);
  }
}

function mixed() {
  var x = [{'null': 0}, {'undefined': 0}]
  for (var i = 0; i < 100; i++) {
    var a = x[i % 2];
    assertEq(null in a, i % 2 == 0);
    assertEq(undefined in a, i % 2 == 1);
  }
}

exists();
missing();
mixed();