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.

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