js/src/jit-test/tests/ion/monomorphic-property-access.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 function Foo() {
     2     for (var i=0; i<10; i++) {
     3         this["p" + i] = i;
     4     }
     5 }
     7 function test1(foo) {
     8     for (var i=0; i<10400; i++) {
     9         foo.p1 = i;
    10         foo.p9 = i;
    11         var x = foo.p0 + foo.p1 + foo.p2 + foo.p8 + foo.p4 +
    12             foo.p5 + foo.p6 + foo.p7 + foo.p3 + foo.p9;
    13         assertEq(x, i + i + 35);
    14     }
    15 }
    17 test1(new Foo);
    19 function Bar(arg) {
    20     if (arg) { // Thwart definite-property analysis.
    21         this.x = 1;
    22         this.y = 2;
    23         this.z = 3;
    24     }
    25 }
    27 function test2(bar) {
    28     for (var i=0; i<10400; i++) {
    29         bar.x++;
    30         bar.y++;
    31         bar.z++;
    32     }
    33     assertEq(bar.x, 10401);
    34     assertEq(bar.y, 10402);
    35     assertEq(bar.z, 10403);
    36 }
    38 test2(new Bar(true));

mercurial