bound-function-proto.js (518B)
1 // When allocating a bound function in JIT code, ensure it ends up with the 2 // correct proto. 3 function f() { 4 var arr = [function(){}, function(){}]; 5 6 arr[0].bind = Function.prototype.bind; 7 arr[1].bind = Function.prototype.bind; 8 9 var proto = {}; 10 Object.setPrototypeOf(arr[1], proto); 11 12 for (var i = 0; i < 2000; i++) { 13 var fun = arr[Number(i > 1000)]; 14 var bound = fun.bind(null); 15 assertEq(Object.getPrototypeOf(bound), i > 1000 ? proto : Function.prototype); 16 } 17 } 18 f();