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

Unified Diff: tests/language/critical_edge_test.dart

Issue 331343004: Avoid critical edge for loop-exits. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove bad comment. Created 6 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
Index: tests/language/critical_edge_test.dart
diff --git a/tests/language/critical_edge_test.dart b/tests/language/critical_edge_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4146790ef81b923cd8518f2729823fce17ff0955
--- /dev/null
+++ b/tests/language/critical_edge_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2014, 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.
+
+// This test broke dart2js.
+// A compiler must not construct a critical edge on this program.
+
+import "package:expect/expect.dart";
+
+String parse(String uri) {
+ int index = 0;
+ int char = -1;
+
+ void parseAuth() {
+ index;
+ char;
+ }
+
+ int state = 0;
+ while (true) {
ngeoffray 2014/06/24 12:39:14 Seems like the "true" is the only difference. Is i
floitsch 2014/06/24 14:44:38 It also uses more variables after the loop. This l
+ char = uri.codeUnitAt(index);
+ if (char == 1234) {
+ state = (index == 0) ? 1 : 2;
+ break;
+ }
+ if (char == 0x3A) {
+ return "good";
+ }
+ index++;
+ }
+
+ if (state == 1) {
+ print(char == 1234);
+ print(index == uri.length);
+ }
+ return "bad";
+}
+
+main() {
+ Expect.equals("good", parse("dart:_foreign_helper"));
+}
« tests/language/critical_edge2_test.dart ('K') | « tests/language/critical_edge2_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698