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

Unified Diff: tests/language/vm/optimized_testsmi_test.dart

Issue 943273004: Fold BIT_NOT and NEGATE during constant propagation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests. Created 5 years, 10 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 | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/vm/optimized_testsmi_test.dart
diff --git a/tests/language/vm/optimized_testsmi_test.dart b/tests/language/vm/optimized_testsmi_test.dart
index d538f207b060036aacfbe6e4a548d24548146553..c5ac9e29559834e6f9113eaa4bda58e4d130658b 100644
--- a/tests/language/vm/optimized_testsmi_test.dart
+++ b/tests/language/vm/optimized_testsmi_test.dart
@@ -7,8 +7,7 @@
import "package:expect/expect.dart";
-test(bool b) {
- var a = 0;
+test1(a, bool b) {
if (b) {
a++;
} else {
@@ -20,11 +19,38 @@ test(bool b) {
return "odd";
}
+test2(a, bool b) {
+ if (b) {
+ a++;
+ } else {
+ a += 2;
+ }
+ if (a & 1 == 1) {
+ return "odd";
+ }
+ return "even";
+}
+
+test3(a, bool b) {
+ return test1(0, b);
+}
+
+test4(a, bool b) {
+ return test2(0, b);
+}
+
+run(test) {
+ Expect.equals("odd", test(0, true));
+ Expect.equals("even", test(0, false));
+ for (var i=0; i<20; i++) test(0, false);
+ Expect.equals("odd", test(0, true));
+ Expect.equals("even", test(0, false));
+}
+
main() {
- Expect.equals("odd", test(true));
- Expect.equals("even", test(false));
- for (var i=0; i<20; i++) test(false);
- Expect.equals("odd", test(true));
- Expect.equals("even", test(false));
+ run(test1);
+ run(test2);
+ run(test3);
+ run(test4);
}
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698