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

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

Issue 15917017: Don't let HCheck instructions prevent GVN. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 | « sdk/lib/_internal/compiler/implementation/ssa/variable_allocator.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/gvn_test.dart
===================================================================
--- tests/compiler/dart2js/gvn_test.dart (revision 23842)
+++ tests/compiler/dart2js/gvn_test.dart (working copy)
@@ -41,7 +41,26 @@
}
""";
+// Check that [HCheck] instructions do not prevent GVN.
+const String TEST_FIVE = r"""
+class A {
+ var foo = 21;
+}
+
+class B {}
+
main() {
+ var a = [new B(), new A()][0];
+ var b = a.foo;
+ var c = a.foo;
+ if (a is B) {
+ c = a.foo;
+ }
+ return b + c;
+}
+""";
+
+main() {
String generated = compile(TEST_ONE, entry: 'foo');
RegExp regexp = new RegExp(r"1 \+ [a-z]+");
checkNumberOfMatches(regexp.allMatches(generated).iterator, 1);
@@ -54,4 +73,8 @@
generated = compile(TEST_FOUR, entry: 'foo');
checkNumberOfMatches(new RegExp("shr").allMatches(generated).iterator, 1);
+
+ generated = compileAll(TEST_FIVE);
+ checkNumberOfMatches(
+ new RegExp("get\\\$foo").allMatches(generated).iterator, 1);
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/variable_allocator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698