|
1 function Foo() { |
|
2 for (var i=0; i<10; i++) { |
|
3 this["p" + i] = i; |
|
4 } |
|
5 } |
|
6 |
|
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 } |
|
16 |
|
17 test1(new Foo); |
|
18 |
|
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 } |
|
26 |
|
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 } |
|
37 |
|
38 test2(new Bar(true)); |