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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/guess_cid_test.dart
===================================================================
--- tests/language/guess_cid_test.dart (revision 0)
+++ tests/language/guess_cid_test.dart (working copy)
@@ -0,0 +1,69 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test program to test arithmetic operations.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr
+
+import "package:expect/expect.dart";
+
+main() {
+ // Warmup optimizes methods.
+ for (int i = 0; i < 100; i++) {
+ Expect.equals(i, compareInt(i));
+ Expect.equals(i.toDouble(), compareDouble(i.toDouble()));
+ Expect.equals(i, binOpInt(i, i));
+ 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.
+ }
+ Expect.equals(3, compareInt(3));
+ Expect.equals(-2, compareInt(-2));
+ Expect.equals(0, compareInt(-1));
+
+ Expect.equals(3, binOpInt(3, 3));
+ 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.
+
+ 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.
+ Expect.equals(0.0, binOpInt(-2, -2));
+
+ Expect.equals(3.0, compareDouble(3.0));
+ Expect.equals(-2.0, compareDouble(-2.0));
+ Expect.equals(0.0, compareDouble(-1.0));
+}
+
+
+int compareInt(int i) {
+ if (i < 0) {
+ // Not visited in before optimization.
+ // Guess cid of comparison below.
+ if (i == -1) return 0;
+ }
+ return i;
+}
+
+
+double compareDouble(double i) {
+ if (i < 0.0) {
+ // Not visited in before optimization.
+ // Guess cid of comparison below.
+ if (i == -1.0) return 0.0;
+ }
+ return i;
+}
+
+
+int binOpInt(int i, int x) {
+ if (i < 0) {
+ // Not visited in before optimization.
+ // 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.
+ return x + 2;
+ }
+ return i;
+}
+
+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.
+ if (i < 0.0) {
+ // Not visited in before optimization.
+ // 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.
+ return x + 2.0;
+ }
+ return i;
+}
« 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