| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 | 4 |
| 5 // Test that the GVN optimization pass works as expected. | 5 // Test that the GVN optimization pass works as expected. |
| 6 | 6 |
| 7 library basic_tests; | 7 library basic_tests; |
| 8 | 8 |
| 9 import 'js_backend_cps_ir.dart'; | 9 import 'js_backend_cps_ir.dart'; |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 var y1 = new Branch(x1, x2); | 47 var y1 = new Branch(x1, x2); |
| 48 var y2 = new Branch(x3, x4); | 48 var y2 = new Branch(x3, x4); |
| 49 var z = new Root(y1, y2); | 49 var z = new Root(y1, y2); |
| 50 print(foo(z, [1,2,3,4,5,6,7,8,9,10])); | 50 print(foo(z, [1,2,3,4,5,6,7,8,9,10])); |
| 51 } | 51 } |
| 52 """,r""" | 52 """,r""" |
| 53 function(x, list) { | 53 function(x, list) { |
| 54 var v0 = x.left, a = v0.left, b = v0.right, sum = 0, k = 0, c = (v0 = x.right)
.left, d = v0.right, i = a.value + c.value, v1 = list[v0 = i * (b.value + d.valu
e)]; | 54 var v0 = x.left, a = v0.left, b = v0.right, sum = 0, k = 0, c = (v0 = x.right)
.left, d = v0.right, i = a.value + c.value, v1 = list[v0 = i * (b.value + d.valu
e)]; |
| 55 for (; k < 10; sum = sum + (v1 + i), k = k + 1) | 55 for (; k < 10; sum = sum + (v1 + i), k = k + 1) |
| 56 if (v0 < 0 || v0 >= 10) | 56 if (v0 < 0 || v0 >= 10) |
| 57 H.ioore(list, v0); | 57 return H.ioore(list, v0); |
| 58 return sum; | 58 return sum; |
| 59 }"""), | 59 }"""), |
| 60 ]; | 60 ]; |
| 61 | 61 |
| 62 void main() { | 62 void main() { |
| 63 runTests(tests); | 63 runTests(tests); |
| 64 } | 64 } |
| OLD | NEW |