summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/typeMonitorCall.js
blob: d80a7dc6266c5e5918e0f2c2a0f27d7c5c1c0b70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* Make sure we are checking argument types when going through unknown but monomorphic call sites. */

function foo(x) {
  return x + 10;
}

var array = [1,2,3,4,5,6,7,"eight"];

/* Jump through hoops to make 'f' unknown. */
var f = this[eval("'foo'")];

for (var i = 0; i < array.length; i++) {
  var res = f(array[i]);
  if (i != 7)
    assertEq(res, i + 11);
  else
    assertEq(res, "eight10");
}