| OLD | NEW |
| 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 | 4 |
| 5 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class OptimizationPhase { | 7 abstract class OptimizationPhase { |
| 8 String get name; | 8 String get name; |
| 9 void visitGraph(HGraph graph); | 9 void visitGraph(HGraph graph); |
| 10 } | 10 } |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 | 1441 |
| 1442 bool canBeMoved = true; | 1442 bool canBeMoved = true; |
| 1443 for (final HInstruction input in current.inputs) { | 1443 for (final HInstruction input in current.inputs) { |
| 1444 if (input.block == block) { | 1444 if (input.block == block) { |
| 1445 canBeMoved = false; | 1445 canBeMoved = false; |
| 1446 break; | 1446 break; |
| 1447 } | 1447 } |
| 1448 } | 1448 } |
| 1449 if (!canBeMoved) continue; | 1449 if (!canBeMoved) continue; |
| 1450 | 1450 |
| 1451 // This is safe because we are running after GVN. | 1451 HInstruction existing = set_.lookup(current); |
| 1452 // TODO(ngeoffray): ensure GVN has been run. | 1452 if (existing == null) { |
| 1453 set_.add(current); | 1453 set_.add(current); |
| 1454 } else { |
| 1455 block.rewriteWithBetterUser(current, existing); |
| 1456 block.remove(current); |
| 1457 } |
| 1454 } | 1458 } |
| 1455 } | 1459 } |
| 1456 } | 1460 } |
| 1457 | 1461 |
| 1458 class SsaTypeConversionInserter extends HBaseVisitor | 1462 class SsaTypeConversionInserter extends HBaseVisitor |
| 1459 implements OptimizationPhase { | 1463 implements OptimizationPhase { |
| 1460 final String name = "SsaTypeconversionInserter"; | 1464 final String name = "SsaTypeconversionInserter"; |
| 1461 final Compiler compiler; | 1465 final Compiler compiler; |
| 1462 | 1466 |
| 1463 SsaTypeConversionInserter(this.compiler); | 1467 SsaTypeConversionInserter(this.compiler); |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1937 | 1941 |
| 1938 keyedValues.forEach((receiver, values) { | 1942 keyedValues.forEach((receiver, values) { |
| 1939 result.keyedValues[receiver] = | 1943 result.keyedValues[receiver] = |
| 1940 new Map<HInstruction, HInstruction>.from(values); | 1944 new Map<HInstruction, HInstruction>.from(values); |
| 1941 }); | 1945 }); |
| 1942 | 1946 |
| 1943 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 1947 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
| 1944 return result; | 1948 return result; |
| 1945 } | 1949 } |
| 1946 } | 1950 } |
| OLD | NEW |