Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: language/mega_load_test.dart

Issue 10540118: - Add test case which will cause a mega-morphic field load. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/tests/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4 // Test megamorphic, but single target field load.
5
6 class Base {
7 var f;
8 }
9
10 class A extends Base {
11 A() { this.f = 0; }
12 }
13
14 class B extends Base {
15 B() { this.f = 1; }
16 }
17
18 class C extends Base {
19 C() { this.f = 2; }
20 }
21
22 class D extends Base {
23 D() { this.f = 3; }
24 }
25
26 class E extends Base {
27 E() { this.f = 4; }
28 }
29
30 class F extends Base {
31 F() { this.f = 5; }
32 }
33
34 class G extends Base {
35 G() { this.f = 6; }
36 }
37
38 class H extends Base {
39 H() { this.f = 7; }
40 }
41
42 class I extends Base {
43 I() { this.f = 8; }
44 }
45
46 class J extends Base {
47 J() { this.f = 9; }
48 }
49
50 class K extends Base {
51 K() { this.f = 10; }
52 }
53
54 class L extends Base {
55 L() { this.f = 11; }
56 }
57
58 class M extends Base {
59 M() { this.f = 12; }
60 }
61
62 class N extends Base {
63 N() { this.f = 13; }
64 }
65
66 class O extends Base {
67 O() { this.f = 14; }
68 }
69
70 class P extends Base {
71 P() { this.f = 15; }
72 }
73
74 class Q extends Base {
75 Q() { this.f = 16; }
76 }
77
78 class R extends Base {
79 R() { this.f = 17; }
80 }
81
82 class S extends Base {
83 S() { this.f = 18; }
84 }
85
86 class T extends Base {
87 T() { this.f = 19; }
88 }
89
90 class U extends Base {
91 U() { this.f = 20; }
92 }
93
94 class V extends Base {
95 V() { this.f = 21; }
96 }
97
98 class W extends Base {
99 V() { this.f = 22; }
100 }
101
102 class X extends Base {
103 V() { this.f = 21; }
104 }
105
106 class Y extends Base {
107 V() { this.f = 24; }
108 }
109
110 class Z extends Base {
111 V() { this.f = 21; }
112 }
113
114 allocateObjects() {
115 var list = new List();
116 list.add(new A());
117 list.add(new B());
118 list.add(new C());
119 list.add(new D());
120 list.add(new E());
121 list.add(new F());
122 list.add(new G());
123 list.add(new H());
124 list.add(new I());
125 list.add(new J());
126 list.add(new K());
127 list.add(new L());
128 list.add(new M());
129 list.add(new N());
130 list.add(new O());
131 list.add(new P());
132 list.add(new Q());
133 list.add(new R());
134 list.add(new S());
135 list.add(new T());
136 list.add(new U());
137 list.add(new V());
138 return list;
139 }
140
141 callThemAll(var list) {
142 for (var i = 0; i < list.length; i++) {
143 Expect.equals(i, list[i].f);
144 }
145 }
146
147 main() {
148 var list = allocateObjects();
149 // Make sure the optimizer triggers the compilation of callThemAll.
150 for (var i = 0; i < 500; i++) {
151 callThemAll(list);
152 }
153 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698