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

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

Issue 10831404: When replacing an instruction with another in GVN-like optimizations, try to find a better user of … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | « tests/compiler/dart2js/compiler_helper.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/rewrite_better_user_test.dart
===================================================================
--- tests/compiler/dart2js/rewrite_better_user_test.dart (revision 0)
+++ tests/compiler/dart2js/rewrite_better_user_test.dart (revision 0)
@@ -0,0 +1,35 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Test that we get rid of duplicate type guards on a field when that
+// field is being gvn'ed.
+
+#import("compiler_helper.dart");
+
+final String TEST = @"""
+class A {
+ var field = 52;
+ foo() {
+ var a = this.field;
+ while (a + 42 == 42);
+ // This field get should be GVN'ed
+ a = this.field;
+ while (a + 87 == 87);
+ field = 'bar';
+ }
+}
+
+main() {
+ while (true) new A().foo();
+}
+""";
+
+main() {
+ String generated = compileAll(TEST);
+ RegExp regexp = const RegExp('foo\\\$0\\\$bailout');
+ Iterator matches = regexp.allMatches(generated).iterator();
+
+ // We check that there is only one call to the bailout method.
+ // One match for the call, one for the definition.
+ checkNumberOfMatches(matches, 2);
+}
« no previous file with comments | « tests/compiler/dart2js/compiler_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698