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

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

Issue 19034002: Add VMOptions to optimize tests that need to be (Part I). (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/allocation_sinking_vm_test.dart ('k') | tests/language/arithmetic_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 // Test canonicalization of simple arithmetic equivalences. 4 // Test canonicalization of simple arithmetic equivalences.
5 // VMOptions=--optimization-counter-threshold=20 --no-use-osr
5 6
6 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
7 8
8 main() { 9 main() {
9 for (var i = 0; i < 5000; i++) { 10 for (var i = 0; i < 50; i++) {
10 Expect.isTrue(mul1double(i) is double); 11 Expect.isTrue(mul1double(i) is double);
11 Expect.equals(i.toDouble(), mul1double(i)); 12 Expect.equals(i.toDouble(), mul1double(i));
12 Expect.equals(0.0, mul0double(i)); 13 Expect.equals(0.0, mul0double(i));
13 Expect.equals(i.toDouble(), add0double(i)); 14 Expect.equals(i.toDouble(), add0double(i));
14 15
15 Expect.equals(i, mul1int(i)); 16 Expect.equals(i, mul1int(i));
16 Expect.equals(i, add0int(i)); 17 Expect.equals(i, add0int(i));
17 Expect.equals(0, mul0int(i)); 18 Expect.equals(0, mul0int(i));
18 Expect.equals(0, and0(i)); 19 Expect.equals(0, and0(i));
19 Expect.equals(i, and1(i)); 20 Expect.equals(i, and1(i));
20 Expect.equals(i, or0(i)); 21 Expect.equals(i, or0(i));
21 Expect.equals(i, xor0(i)); 22 Expect.equals(i, xor0(i));
22 } 23 }
23 24
24 Expect.isTrue(mul0double(double.NAN).isNaN); 25 Expect.isTrue(mul0double(double.NAN).isNaN);
25 Expect.isFalse(add0double(-0.0).isNegative); 26 Expect.isFalse(add0double(-0.0).isNegative);
26 } 27 }
27 28
28 mul1double(x) => 1.0 * x; 29 mul1double(x) => 1.0 * x;
29 mul0double(x) => 0.0 * x; 30 mul0double(x) => 0.0 * x;
30 add0double(x) => 0.0 + x; 31 add0double(x) => 0.0 + x;
31 32
32 mul1int(x) => 1 * x; 33 mul1int(x) => 1 * x;
33 mul0int(x) => 0 * x; 34 mul0int(x) => 0 * x;
34 add0int(x) => 0 + x; 35 add0int(x) => 0 + x;
35 and0(x) => 0 & x; 36 and0(x) => 0 & x;
36 or0(x) => 0 | x; 37 or0(x) => 0 | x;
37 xor0(x) => 0 ^ x; 38 xor0(x) => 0 ^ x;
38 and1(x) => (-1) & x; 39 and1(x) => (-1) & x;
OLDNEW
« no previous file with comments | « tests/language/allocation_sinking_vm_test.dart ('k') | tests/language/arithmetic_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698