summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/call-generic-fun-call.js
blob: d3e7671dea5da59106e6e662177ce49f2fe8a4ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Test that the generic call trampoline implements fun_call correctly,
// even nested fun_call.

function foo(f) {
  var call = f.call;
  return call.call(call, call, call, f, {}, 1);
}

function f1(x) { return x; }
var f2 = f1.bind({});
var f3 = Math.log;
var f4 = { call: () => { return 2;} }

with ({}) {}
for (var i = 0; i < 2000; i++) {
  assertEq(foo(f4), 2);
  assertEq(foo(f1), 1);
  assertEq(foo(f2), 1);
  assertEq(foo(f3), 0);
}