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

Side by Side Diff: tests/language/try_catch_optimized1_test.dart

Issue 18563006: More tests updated to optimize code (Part 2). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 | « tests/language/try_catch5_test.dart ('k') | tests/language/try_catch_test.dart » ('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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--optimization-counter-threshold=10 --no-use-osr
4 5
5 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
6 7
7 maythrow(x) { 8 maythrow(x) {
8 if (x == null) throw 42; 9 if (x == null) throw 42;
9 return 99; 10 return 99;
10 } 11 }
11 12
12 13
13 f1(x) { 14 f1(x) {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 228 }
228 maythrow(x); 229 maythrow(x);
229 } catch(e) { 230 } catch(e) {
230 result++; 231 result++;
231 } 232 }
232 return result; 233 return result;
233 } 234 }
234 235
235 236
236 main() { 237 main() {
237 for (var i=0; i<10000; i++) f1("abc"); 238 for (var i = 0; i < 20; i++) f1("abc");
238 Expect.equals(99, f1("abc")); 239 Expect.equals(99, f1("abc"));
239 Expect.equals(0, f1(null)); 240 Expect.equals(0, f1(null));
240 241
241 for (var i=0; i<10000; i++) f2("abc"); 242 for (var i = 0; i < 20; i++) f2("abc");
242 Expect.equals(99, f2("abc")); 243 Expect.equals(99, f2("abc"));
243 Expect.equals(null, f2(null)); 244 Expect.equals(null, f2(null));
244 245
245 f3("123", 0); 246 f3("123", 0);
246 for (var i=0; i<10000; i++) f3(null, 0); 247 for (var i = 0; i < 20; i++) f3(null, 0);
247 Expect.equals(99, f3("123", 0)); 248 Expect.equals(99, f3("123", 0));
248 Expect.equals(0x40000000, f3(null, 0x3fffffff)); 249 Expect.equals(0x40000000, f3(null, 0x3fffffff));
249 250
250 f4(null); 251 f4(null);
251 for (var i=0; i<10000; i++) f4(123); 252 for (var i = 0; i < 20; i++) f4(123);
252 f4(null); 253 f4(null);
253 254
254 f5(null); 255 f5(null);
255 for (var i=0; i<10000; i++) f5(123); 256 for (var i = 0; i < 20; i++) f5(123);
256 f5(null); 257 f5(null);
257 258
258 f6(null, 1); 259 f6(null, 1);
259 for (var i=0; i<10000; i++) f6(123, 1); 260 for (var i = 0; i < 20; i++) f6(123, 1);
260 f6(null, 1); 261 f6(null, 1);
261 262
262 f7("1.2"); 263 f7("1.2");
263 f7("Infinity"); 264 f7("Infinity");
264 f7("-Infinity"); 265 f7("-Infinity");
265 for (var i=0; i<10000; i++) f7("1.2"); 266 for (var i = 0; i < 20; i++) f7("1.2");
266 Expect.equals(false, f7("1.2")); 267 Expect.equals(false, f7("1.2"));
267 Expect.equals(true, f7("Infinity")); 268 Expect.equals(true, f7("Infinity"));
268 Expect.equals(true, f7("-Infinity")); 269 Expect.equals(true, f7("-Infinity"));
269 Expect.equals(false, f7("123456789012345")); // Deopt. 270 Expect.equals(false, f7("123456789012345")); // Deopt.
270 for (var i=0; i<10000; i++) f7("123456789012345"); 271 for (var i = 0; i < 20; i++) f7("123456789012345");
271 Expect.equals(true, f7("Infinity")); 272 Expect.equals(true, f7("Infinity"));
272 Expect.equals(true, f7("-Infinity")); 273 Expect.equals(true, f7("-Infinity"));
273 274
274 for (var i=0; i<10000; i++) f8(null); 275 for (var i = 0; i < 20; i++) f8(null);
275 f8(null); 276 f8(null);
276 277
277 f9(5); 278 f9(5);
278 f9(5.0); 279 f9(5.0);
279 for (var i=0; i<10000; i++) f9(3); 280 for (var i = 0; i < 20; i++) f9(3);
280 f9(3); 281 f9(3);
281 282
282 var y = 1.0; 283 var y = 1.0;
283 Expect.equals(0, f10(null, y)); 284 Expect.equals(0, f10(null, y));
284 for (var i = 0; i < 10000; i++) f10("abc", y); 285 for (var i = 0; i < 20; i++) f10("abc", y);
285 Expect.equals(99, f10("abc", y)); 286 Expect.equals(99, f10("abc", y));
286 Expect.equals(0, f10(null, y)); 287 Expect.equals(0, f10(null, y));
287 288
288 for (var i=0; i<10000; i++) f11("abc"); 289 for (var i = 0; i < 20; i++) f11("abc");
289 Expect.equals(99, f11("abc")); 290 Expect.equals(99, f11("abc"));
290 Expect.equals(0, f11(null)); 291 Expect.equals(0, f11(null));
291 292
292 for (var i=0; i<10000; i++) f12(null); 293 for (var i = 0; i < 20; i++) f12(null);
293 f12(null); 294 f12(null);
294 295
295 f13(null); 296 f13(null);
296 for (var i=0; i<10000; i++) f13("abc"); 297 for (var i = 0; i < 20; i++) f13("abc");
297 Expect.equals(99, f13("abc")); 298 Expect.equals(99, f13("abc"));
298 Expect.equals(1, f13(null)); 299 Expect.equals(1, f13(null));
299 } 300 }
OLDNEW
« no previous file with comments | « tests/language/try_catch5_test.dart ('k') | tests/language/try_catch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698