summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/object-is-polymorphic.js
blob: 137c710c15efa0beda3ff2118ae6055c3b2b898a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function foo(arr) {
  var result = 0;
  for (var i = 0; i < arr.length; i++) {
    for (var j = 0; j < arr.length; j++) {
      if (Object.is(arr[i], arr[j])) {
        result++;
      }
    }
  }
  return result;
}

var input = [1,"one",{x:1},
	     1,"one",{x:1}];

var sum = 0;
for (var i = 0; i < 100; i++) {
  sum += foo(input);
}
assertEq(sum, 1000);