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

Unified Diff: tests/compiler/dart2js/value_range_test.dart

Issue 10986085: Deal with more conditional expressions in the value range analyzer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/ssa/value_range_analyzer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/value_range_test.dart
===================================================================
--- tests/compiler/dart2js/value_range_test.dart (revision 13209)
+++ tests/compiler/dart2js/value_range_test.dart (working copy)
@@ -128,7 +128,74 @@
return a[1] + a[0];
}
""",
-ONE_CHECK
+ONE_CHECK,
+
+"""
+main() {
+ var a = new List();
+ var sum = 0;
+ for (int i = 0; i <= a.length - 1; i++) {
+ sum += a[i];
+ }
+ return sum;
+}
+""",
+REMOVED,
+
+"""
+main() {
+ var a = new List();
+ var sum = 0;
+ for (int i = a.length - 1; i >=0; i--) {
+ sum += a[i];
+ }
+ return sum;
+}
+""",
+REMOVED,
+
+"""
+main(value) {
+ // Force [value] to be an int by having the speculative optimizer
+ // want an int.
+ int sum = 0;
+ for (int i = 0; i < 42; i++) sum += (value & 4);
+ var a = new List();
+ if (value > a.length - 1) return;
+ if (value < 0) return;
+ return a[value];
+}
+""",
+REMOVED,
+
+"""
+main(value) {
+ // Force [value] to be an int by having the speculative optimizer
+ // want an int.
+ int sum = 0;
+ for (int i = 0; i < 42; i++) sum += (value & 4);
+ var a = new List();
+ if (value <= a.length - 1) {
+ if (value >= 0) {
+ return a[value];
+ }
+ }
+}
+""",
+REMOVED,
+"""
+main(value) {
+ // Force [value] to be an int by having the speculative optimizer
+ // want an int.
+ int sum = 0;
+ for (int i = 0; i < 42; i++) sum += (value & 4);
+ var a = new List();
+ if (value >= a.length) return;
+ if (value <= -1) return;
+ return a[value];
+}
+""",
+REMOVED,
];
expect(String code, int kind) {
« no previous file with comments | « lib/compiler/implementation/ssa/value_range_analyzer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698