js/src/jit-test/tests/ion/monomorphic-property-access.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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