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

Side by Side Diff: tests/language/if_conversion_vm_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
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 4
5 // Test if-convertion pass in the optimizing compiler. 5 // Test if-convertion pass in the optimizing compiler.
6 // VMOptions=--optimization-counter-threshold=10 --no-use-osr
6 7
7 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
8 9
9 f1(i) => (i == 0) ? 0 : 1; 10 f1(i) => (i == 0) ? 0 : 1;
10 f2(i) => (i == 0) ? 2 : 3; 11 f2(i) => (i == 0) ? 2 : 3;
11 f3(i) => (i == null) ? 0 : 1; 12 f3(i) => (i == null) ? 0 : 1;
12 f4(i) => (i == null) ? 2 : 3; 13 f4(i) => (i == null) ? 2 : 3;
13 14
14 f5(i) => (i != 0) ? 0 : 1; 15 f5(i) => (i != 0) ? 0 : 1;
15 f6(i) => (i != 0) ? 2 : 3; 16 f6(i) => (i != 0) ? 2 : 3;
(...skipping 17 matching lines...) Expand all
33 cse(i) { 34 cse(i) {
34 final a = i == 0 ? 0 : 1; 35 final a = i == 0 ? 0 : 1;
35 final b = i == 0 ? 2 : 3; 36 final b = i == 0 ? 2 : 3;
36 return a + b; 37 return a + b;
37 } 38 }
38 39
39 f17(b) => b ? 0 : 11; 40 f17(b) => b ? 0 : 11;
40 f18(b) => b ? 2 : 0; 41 f18(b) => b ? 2 : 0;
41 42
42 main() { 43 main() {
43 for (var i = 0; i < 10000; i++) { 44 for (var i = 0; i < 20; i++) {
44 f1(i); 45 f1(i);
45 f2(i); 46 f2(i);
46 f3(i); 47 f3(i);
47 f4(i); 48 f4(i);
48 f5(i); 49 f5(i);
49 f6(i); 50 f6(i);
50 f7(i); 51 f7(i);
51 f8(i); 52 f8(i);
52 f9(i); 53 f9(i);
53 f10(i); 54 f10(i);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 Expect.equals(POWER_OF_2, bigPower(12)); 104 Expect.equals(POWER_OF_2, bigPower(12));
104 105
105 Expect.equals(2, cse(0)); 106 Expect.equals(2, cse(0));
106 Expect.equals(4, cse(1)); 107 Expect.equals(4, cse(1));
107 108
108 Expect.equals(11, f17(false)); 109 Expect.equals(11, f17(false));
109 Expect.equals(0, f17(true)); 110 Expect.equals(0, f17(true));
110 111
111 Expect.equals(0, f18(false)); 112 Expect.equals(0, f18(false));
112 Expect.equals(2, f18(true)); 113 Expect.equals(2, f18(true));
113 } 114 }
OLDNEW
« no previous file with comments | « tests/language/identical_test.dart ('k') | tests/language/inline_add_constants_to_initial_env_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698