Chromium Code Reviews| Index: tests/compiler/dart2js/ssa_phi_codegen_test.dart |
| =================================================================== |
| --- tests/compiler/dart2js/ssa_phi_codegen_test.dart (revision 20466) |
| +++ tests/compiler/dart2js/ssa_phi_codegen_test.dart (working copy) |
| @@ -55,6 +55,17 @@ |
| } |
| """; |
| +const String TEST_FIVE = r""" |
| +void main() { |
| + var hash = 0; |
| + for (var i = 0; i == 0; i = i + 1) { |
| + hash = hash + 10; |
|
ngeoffray
2013/03/26 11:29:02
The codegen recognizes that "hash + 10" can be gen
|
| + hash = hash + 42; |
|
ngeoffray
2013/03/26 11:29:02
We would generate:
hash0 = hash + 10 + 42
Now we
|
| + } |
| + print(t); |
| +} |
| +"""; |
| + |
| main() { |
| compileAndMatchFuzzy(TEST_ONE, 'foo', "var x = x === true \\? 2 : 3;"); |
| compileAndMatchFuzzy(TEST_ONE, 'foo', "print\\(x\\);"); |
| @@ -69,6 +80,7 @@ |
| // only generates one instruction. |
| compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42'); |
| - var generated = compile(TEST_FOUR, entry: 'foo'); |
| compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;'); |
| + |
| + compileAndDoNotMatch(TEST_FIVE, 'main', new RegExp('hash0')); |
| } |