js/src/jit-test/tests/baseline/bug892787-2.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:fc880d09308b
1 // Constructing calls should throw if !callee->isInterpretedConstructor().
2 // This tests the polymorphic call path.
3
4 for (var i=0; i<20; i++)
5 Function.prototype();
6
7 var funs = [
8 function() { return 1; },
9 function() { return 2; },
10 function() { return 3; },
11 function() { return 4; },
12 function() { return 5; },
13 function() { return 6; },
14 function() { return 7; },
15 function() { return 8; },
16 function() { return 9; },
17 function() { return 10; },
18 Function.prototype
19 ];
20
21 function f(callee) {
22 new callee;
23 }
24 function g() {
25 var c = 0;
26 for (var i=0; i<50; i++) {
27 try {
28 f(funs[i % funs.length]);
29 } catch (e) {
30 assertEq(e.message.contains("not a constructor"), true);
31 c++;
32 }
33 }
34 assertEq(c, 4);
35 }
36 g();

mercurial