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

Side by Side Diff: test/mjsunit/array-constructor-feedback.js

Issue 19807002: Turn on parallel recompilation for tests that assert optimization status. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix small details. no logic change. Created 7 years, 5 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 | « test/mjsunit/array-bounds-check-removal.js ('k') | test/mjsunit/array-feedback.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 function bar0(t) { 113 function bar0(t) {
114 return new t(); 114 return new t();
115 } 115 }
116 a = bar0(Array); 116 a = bar0(Array);
117 a[0] = 3.5; 117 a[0] = 3.5;
118 b = bar0(Array); 118 b = bar0(Array);
119 assertKind(elements_kind.fast_double, b); 119 assertKind(elements_kind.fast_double, b);
120 %OptimizeFunctionOnNextCall(bar0); 120 %OptimizeFunctionOnNextCall(bar0);
121 b = bar0(Array); 121 b = bar0(Array);
122 assertKind(elements_kind.fast_double, b); 122 assertKind(elements_kind.fast_double, b);
123 assertTrue(2 != %GetOptimizationStatus(bar0)); 123 assertOptimized(bar0);
124 // bar0 should deopt 124 // bar0 should deopt
125 b = bar0(Object); 125 b = bar0(Object);
126 assertTrue(1 != %GetOptimizationStatus(bar0)); 126 assertUnoptimized(bar0)
127 // When it's re-optimized, we should call through the full stub 127 // When it's re-optimized, we should call through the full stub
128 bar0(Array); 128 bar0(Array);
129 %OptimizeFunctionOnNextCall(bar0); 129 %OptimizeFunctionOnNextCall(bar0);
130 b = bar0(Array); 130 b = bar0(Array);
131 // We also lost our ability to record kind feedback, as the site 131 // We also lost our ability to record kind feedback, as the site
132 // is megamorphic now. 132 // is megamorphic now.
133 assertKind(elements_kind.fast_smi_only, b); 133 assertKind(elements_kind.fast_smi_only, b);
134 assertTrue(2 != %GetOptimizationStatus(bar0)); 134 assertOptimized(bar0);
135 b[0] = 3.5; 135 b[0] = 3.5;
136 c = bar0(Array); 136 c = bar0(Array);
137 assertKind(elements_kind.fast_smi_only, c); 137 assertKind(elements_kind.fast_smi_only, c);
138 })(); 138 })();
139 139
140 140
141 // Test: Ensure that bailouts from the stub don't deopt a crankshafted 141 // Test: Ensure that bailouts from the stub don't deopt a crankshafted
142 // method with a call to that stub. 142 // method with a call to that stub.
143 (function() { 143 (function() {
144 function bar(len) { 144 function bar(len) {
145 return new Array(len); 145 return new Array(len);
146 } 146 }
147 a = bar(10); 147 a = bar(10);
148 a[0] = "a string"; 148 a[0] = "a string";
149 a = bar(10); 149 a = bar(10);
150 assertKind(elements_kind.fast, a); 150 assertKind(elements_kind.fast, a);
151 %OptimizeFunctionOnNextCall(bar); 151 %OptimizeFunctionOnNextCall(bar);
152 a = bar(10); 152 a = bar(10);
153 assertKind(elements_kind.fast, a); 153 assertKind(elements_kind.fast, a);
154 assertTrue(2 != %GetOptimizationStatus(bar)); 154 assertOptimized(bar);
155 // The stub bails out, but the method call should be fine. 155 // The stub bails out, but the method call should be fine.
156 a = bar(100000); 156 a = bar(100000);
157 assertTrue(2 != %GetOptimizationStatus(bar)); 157 assertOptimized(bar);
158 assertKind(elements_kind.dictionary, a); 158 assertKind(elements_kind.dictionary, a);
159 159
160 // If the argument isn't a smi, it bails out as well 160 // If the argument isn't a smi, it bails out as well
161 a = bar("oops"); 161 a = bar("oops");
162 assertTrue(2 != %GetOptimizationStatus(bar)); 162 assertOptimized(bar);
163 assertKind(elements_kind.fast, a); 163 assertKind(elements_kind.fast, a);
164 164
165 function barn(one, two, three) { 165 function barn(one, two, three) {
166 return new Array(one, two, three); 166 return new Array(one, two, three);
167 } 167 }
168 168
169 barn(1, 2, 3); 169 barn(1, 2, 3);
170 barn(1, 2, 3); 170 barn(1, 2, 3);
171 %OptimizeFunctionOnNextCall(barn); 171 %OptimizeFunctionOnNextCall(barn);
172 barn(1, 2, 3); 172 barn(1, 2, 3);
173 assertTrue(2 != %GetOptimizationStatus(barn)); 173 assertOptimized(barn);
174 a = barn(1, "oops", 3); 174 a = barn(1, "oops", 3);
175 // The stub should bail out but the method should remain optimized. 175 // The stub should bail out but the method should remain optimized.
176 assertKind(elements_kind.fast, a); 176 assertKind(elements_kind.fast, a);
177 assertTrue(2 != %GetOptimizationStatus(barn)); 177 assertOptimized(barn);
178 })(); 178 })();
179 179
180 180
181 // Test: When a method with array constructor is crankshafted, the type 181 // Test: When a method with array constructor is crankshafted, the type
182 // feedback for elements kind is baked in. Verify that transitions don't 182 // feedback for elements kind is baked in. Verify that transitions don't
183 // change it anymore 183 // change it anymore
184 (function() { 184 (function() {
185 function bar() { 185 function bar() {
186 return new Array(); 186 return new Array();
187 } 187 }
188 a = bar(); 188 a = bar();
189 bar(); 189 bar();
190 %OptimizeFunctionOnNextCall(bar); 190 %OptimizeFunctionOnNextCall(bar);
191 b = bar(); 191 b = bar();
192 // This only makes sense to test if we allow crankshafting 192 // This only makes sense to test if we allow crankshafting
193 if (4 != %GetOptimizationStatus(bar)) { 193 if (4 != %GetOptimizationStatus(bar)) {
194 assertTrue(2 != %GetOptimizationStatus(bar)); 194 assertOptimized(bar);
195 %DebugPrint(3); 195 %DebugPrint(3);
196 b[0] = 3.5; 196 b[0] = 3.5;
197 c = bar(); 197 c = bar();
198 assertKind(elements_kind.fast_smi_only, c); 198 assertKind(elements_kind.fast_smi_only, c);
199 assertTrue(2 != %GetOptimizationStatus(bar)); 199 assertOptimized(bar);
200 } 200 }
201 })(); 201 })();
202 202
203 203
204 // Test: create arrays in two contexts, verifying that the correct 204 // Test: create arrays in two contexts, verifying that the correct
205 // map for Array in that context will be used. 205 // map for Array in that context will be used.
206 (function() { 206 (function() {
207 function bar() { return new Array(); } 207 function bar() { return new Array(); }
208 bar(); 208 bar();
209 bar(); 209 bar();
210 %OptimizeFunctionOnNextCall(bar); 210 %OptimizeFunctionOnNextCall(bar);
211 a = bar(); 211 a = bar();
212 assertTrue(a instanceof Array); 212 assertTrue(a instanceof Array);
213 213
214 var contextB = Realm.create(); 214 var contextB = Realm.create();
215 Realm.eval(contextB, "function bar2() { return new Array(); };"); 215 Realm.eval(contextB, "function bar2() { return new Array(); };");
216 Realm.eval(contextB, "bar2(); bar2();"); 216 Realm.eval(contextB, "bar2(); bar2();");
217 Realm.eval(contextB, "%OptimizeFunctionOnNextCall(bar2);"); 217 Realm.eval(contextB, "%OptimizeFunctionOnNextCall(bar2);");
218 Realm.eval(contextB, "bar2();"); 218 Realm.eval(contextB, "bar2();");
219 assertFalse(Realm.eval(contextB, "bar2();") instanceof Array); 219 assertFalse(Realm.eval(contextB, "bar2();") instanceof Array);
220 assertTrue(Realm.eval(contextB, "bar2() instanceof Array")); 220 assertTrue(Realm.eval(contextB, "bar2() instanceof Array"));
221 })(); 221 })();
222 } 222 }
OLDNEW
« no previous file with comments | « test/mjsunit/array-bounds-check-removal.js ('k') | test/mjsunit/array-feedback.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698