Index: tests/compiler/dart2js/gvn_test.dart |
=================================================================== |
--- tests/compiler/dart2js/gvn_test.dart (revision 17449) |
+++ tests/compiler/dart2js/gvn_test.dart (working copy) |
@@ -23,6 +23,23 @@ |
} |
"""; |
+// Check that is checks get GVN'ed. |
+const String TEST_THREE = r""" |
+void foo(a) { |
+ print(a is num); |
+ print(a is num); |
+} |
+"""; |
+ |
+// Check that instructions that don't have a builtin equivalent can |
+// still be GVN'ed. |
+const String TEST_FOUR = r""" |
+void foo(a) { |
+ print(1 >> a); |
+ print(1 >> a); |
+} |
+"""; |
+ |
main() { |
String generated = compile(TEST_ONE, entry: 'foo'); |
RegExp regexp = new RegExp(r"1 \+ [a-z]+"); |
@@ -30,4 +47,10 @@ |
generated = compile(TEST_TWO, entry: 'foo'); |
checkNumberOfMatches(new RegExp("length").allMatches(generated).iterator, 1); |
+ |
+ generated = compile(TEST_THREE, entry: 'foo'); |
+ checkNumberOfMatches(new RegExp("number").allMatches(generated).iterator, 1); |
+ |
+ generated = compile(TEST_FOUR, entry: 'foo'); |
+ checkNumberOfMatches(new RegExp("shr").allMatches(generated).iterator, 1); |
} |