Chromium Code Reviews| 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")); |
| +} |