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

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

Issue 104893003: For instance call representing numerical comparisons (double and Smi for now) that were never visit… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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 | « runtime/vm/flow_graph_optimizer.cc ('k') | 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) 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
3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test program to test arithmetic operations.
5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr
6
7 import "package:expect/expect.dart";
8
9 main() {
10 // Warmup optimizes methods.
11 for (int i = 0; i < 100; i++) {
12 Expect.equals(i, compareInt(i));
13 Expect.equals(i.toDouble(), compareDouble(i.toDouble()));
14 Expect.equals(i, binOpInt(i, i));
15 Expect.equals(i.toDouble(), binOpInt(i.toDouble(), i.toDouble()));
Florian Schneider 2013/12/06 10:15:28 s/binOpInt/binOpDouble/ ?
srdjan 2013/12/10 01:02:49 Done.
16 }
17 Expect.equals(3, compareInt(3));
18 Expect.equals(-2, compareInt(-2));
19 Expect.equals(0, compareInt(-1));
20
21 Expect.equals(3, binOpInt(3, 3));
22 Expect.equals(0, binOpInt(-2.0, -2.0));
Florian Schneider 2013/12/06 10:15:28 binOpDouble?
srdjan 2013/12/10 01:02:49 Done.
23
24 Expect.equals(3.0, binOpInt(3.0, 3.0));
Florian Schneider 2013/12/06 10:15:28 binOpDouble?
srdjan 2013/12/10 01:02:49 Done.
25 Expect.equals(0.0, binOpInt(-2, -2));
26
27 Expect.equals(3.0, compareDouble(3.0));
28 Expect.equals(-2.0, compareDouble(-2.0));
29 Expect.equals(0.0, compareDouble(-1.0));
30 }
31
32
33 int compareInt(int i) {
34 if (i < 0) {
35 // Not visited in before optimization.
36 // Guess cid of comparison below.
37 if (i == -1) return 0;
38 }
39 return i;
40 }
41
42
43 double compareDouble(double i) {
44 if (i < 0.0) {
45 // Not visited in before optimization.
46 // Guess cid of comparison below.
47 if (i == -1.0) return 0.0;
48 }
49 return i;
50 }
51
52
53 int binOpInt(int i, int x) {
54 if (i < 0) {
55 // Not visited in before optimization.
56 // Guess cid of comparison below.
Florian Schneider 2013/12/06 10:15:28 s/comparison/binary operation/
srdjan 2013/12/10 01:02:49 Done.
57 return x + 2;
58 }
59 return i;
60 }
61
62 double binOpDouble(double i, double x) {
Florian Schneider 2013/12/06 10:15:28 This function is not called in the test yet.
srdjan 2013/12/10 01:02:49 Done.
63 if (i < 0.0) {
64 // Not visited in before optimization.
65 // Guess cid of comparison below.
Florian Schneider 2013/12/06 10:15:28 s/comparison/binary operation/
srdjan 2013/12/10 01:02:49 Done.
66 return x + 2.0;
67 }
68 return i;
69 }
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698