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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // Constructing calls should throw if !callee->isInterpretedConstructor().
     2 // This tests the polymorphic call path.
     4 for (var i=0; i<20; i++)
     5     Function.prototype();
     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 ];
    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