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

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

Issue 12051013: Cleanup how we handle side effects in HInstruction and put the right flags for HIs, modulo, truncat… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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
Index: tests/compiler/dart2js/gvn_test.dart
===================================================================
--- tests/compiler/dart2js/gvn_test.dart (revision 17440)
+++ tests/compiler/dart2js/gvn_test.dart (working copy)
@@ -13,10 +13,21 @@
}
""";
+// Check that modulo does not have any side effect and we are
+// GVN'ing the length of [:list:].
+const String TEST_TWO = r"""
+void foo(a) {
+ var list = new List<int>();
+ list[0] = list[0 % a];
+ list[1] = list[1 % a];
+}
+""";
+
main() {
String generated = compile(TEST_ONE, entry: 'foo');
RegExp regexp = new RegExp(r"1 \+ [a-z]+");
- Iterator matches = regexp.allMatches(generated).iterator;
- Expect.isTrue(matches.moveNext());
- Expect.isFalse(matches.moveNext());
+ checkNumberOfMatches(regexp.allMatches(generated).iterator, 1);
+
+ generated = compile(TEST_TWO, entry: 'foo');
+ checkNumberOfMatches(new RegExp("length").allMatches(generated).iterator, 1);
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/tracer.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698