1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/baseline/bug892787-2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +// Constructing calls should throw if !callee->isInterpretedConstructor(). 1.5 +// This tests the polymorphic call path. 1.6 + 1.7 +for (var i=0; i<20; i++) 1.8 + Function.prototype(); 1.9 + 1.10 +var funs = [ 1.11 + function() { return 1; }, 1.12 + function() { return 2; }, 1.13 + function() { return 3; }, 1.14 + function() { return 4; }, 1.15 + function() { return 5; }, 1.16 + function() { return 6; }, 1.17 + function() { return 7; }, 1.18 + function() { return 8; }, 1.19 + function() { return 9; }, 1.20 + function() { return 10; }, 1.21 + Function.prototype 1.22 +]; 1.23 + 1.24 +function f(callee) { 1.25 + new callee; 1.26 +} 1.27 +function g() { 1.28 + var c = 0; 1.29 + for (var i=0; i<50; i++) { 1.30 + try { 1.31 + f(funs[i % funs.length]); 1.32 + } catch (e) { 1.33 + assertEq(e.message.contains("not a constructor"), true); 1.34 + c++; 1.35 + } 1.36 + } 1.37 + assertEq(c, 4); 1.38 +} 1.39 +g();