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

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

mercurial