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

Side by Side Diff: tests/compiler/dart2js/ssa_phi_codegen_test.dart

Issue 13090002: Free names of inputs of an instruction that is generate at use site. An input of an instruction tha… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Test that parameters keep their names in the output. 4 // Test that parameters keep their names in the output.
5 5
6 import 'compiler_helper.dart'; 6 import 'compiler_helper.dart';
7 7
8 const String TEST_ONE = r""" 8 const String TEST_ONE = r"""
9 void foo(bar) { 9 void foo(bar) {
10 var a = 1; 10 var a = 1;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (i == 9) a = false; 48 if (i == 9) a = false;
49 for (var j = 0; b; j = j + 1) { 49 for (var j = 0; b; j = j + 1) {
50 if (j == 9) b = false; 50 if (j == 9) b = false;
51 } 51 }
52 } 52 }
53 print(a); 53 print(a);
54 print(b); 54 print(b);
55 } 55 }
56 """; 56 """;
57 57
58 const String TEST_FIVE = r"""
59 void main() {
60 var hash = 0;
61 for (var i = 0; i == 0; i = i + 1) {
62 hash = hash + 10;
ngeoffray 2013/03/26 11:29:02 The codegen recognizes that "hash + 10" can be gen
63 hash = hash + 42;
ngeoffray 2013/03/26 11:29:02 We would generate: hash0 = hash + 10 + 42 Now we
64 }
65 print(t);
66 }
67 """;
68
58 main() { 69 main() {
59 compileAndMatchFuzzy(TEST_ONE, 'foo', "var x = x === true \\? 2 : 3;"); 70 compileAndMatchFuzzy(TEST_ONE, 'foo', "var x = x === true \\? 2 : 3;");
60 compileAndMatchFuzzy(TEST_ONE, 'foo', "print\\(x\\);"); 71 compileAndMatchFuzzy(TEST_ONE, 'foo', "print\\(x\\);");
61 72
62 compileAndMatchFuzzy(TEST_TWO, 'main', "x \\+= 10"); 73 compileAndMatchFuzzy(TEST_TWO, 'main', "x \\+= 10");
63 compileAndMatchFuzzy(TEST_TWO, 'main', "\\+\\+x"); 74 compileAndMatchFuzzy(TEST_TWO, 'main', "\\+\\+x");
64 75
65 // Check that we don't have 'd = d' (using regexp back references). 76 // Check that we don't have 'd = d' (using regexp back references).
66 compileAndDoNotMatchFuzzy(TEST_THREE, 'foo', '(x) = \1'); 77 compileAndDoNotMatchFuzzy(TEST_THREE, 'foo', '(x) = \1');
67 compileAndMatchFuzzy(TEST_THREE, 'foo', 'return x'); 78 compileAndMatchFuzzy(TEST_THREE, 'foo', 'return x');
68 // Check that a store just after the declaration of the local 79 // Check that a store just after the declaration of the local
69 // only generates one instruction. 80 // only generates one instruction.
70 compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42'); 81 compileAndMatchFuzzy(TEST_THREE, 'foo', 'x = 42');
71 82
72 var generated = compile(TEST_FOUR, entry: 'foo');
73 compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;'); 83 compileAndDoNotMatchFuzzy(TEST_FOUR, 'foo', '(x) = \1;');
84
85 compileAndDoNotMatch(TEST_FIVE, 'main', new RegExp('hash0'));
74 } 86 }
OLDNEW
« tests/co19/co19-dart2js.status ('K') | « tests/co19/co19-dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698