Chromium Code Reviews| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 new SsaTypePropagator(compiler), | 48 new SsaTypePropagator(compiler), |
| 49 // Run a dead code eliminator before LICM because dead | 49 // Run a dead code eliminator before LICM because dead |
| 50 // interceptors are often in the way of LICM'able instructions. | 50 // interceptors are often in the way of LICM'able instructions. |
| 51 new SsaDeadCodeEliminator(compiler, this), | 51 new SsaDeadCodeEliminator(compiler, this), |
| 52 new SsaGlobalValueNumberer(compiler), | 52 new SsaGlobalValueNumberer(compiler), |
| 53 // After GVN, some instructions might need their type to be | 53 // After GVN, some instructions might need their type to be |
| 54 // updated because they now have different inputs. | 54 // updated because they now have different inputs. |
| 55 new SsaTypePropagator(compiler), | 55 new SsaTypePropagator(compiler), |
| 56 new SsaCodeMotion(), | 56 new SsaCodeMotion(), |
| 57 new SsaLoadElimination(compiler), | 57 new SsaLoadElimination(compiler), |
| 58 new SsaRedundantPhiEliminator(), | |
| 58 new SsaDeadPhiEliminator(), | 59 new SsaDeadPhiEliminator(), |
| 59 new SsaTypePropagator(compiler), | 60 new SsaTypePropagator(compiler), |
| 60 new SsaValueRangeAnalyzer(compiler, constantSystem, this, work), | 61 new SsaValueRangeAnalyzer(compiler, constantSystem, this, work), |
| 61 // Previous optimizations may have generated new | 62 // Previous optimizations may have generated new |
| 62 // opportunities for instruction simplification. | 63 // opportunities for instruction simplification. |
| 63 new SsaInstructionSimplifier(constantSystem, backend, this, work), | 64 new SsaInstructionSimplifier(constantSystem, backend, this, work), |
| 64 new SsaCheckInserter( | 65 new SsaCheckInserter( |
| 65 trustPrimitives, backend, work, context.boundsChecked), | 66 trustPrimitives, backend, work, context.boundsChecked), |
| 66 ]; | 67 ]; |
| 67 phases.forEach(runPhase); | 68 phases.forEach(runPhase); |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 type, | 835 type, |
| 835 HTypeConversion.CHECKED_MODE_CHECK); | 836 HTypeConversion.CHECKED_MODE_CHECK); |
| 836 if (other != value) { | 837 if (other != value) { |
| 837 node.block.addBefore(node, other); | 838 node.block.addBefore(node, other); |
| 838 value = other; | 839 value = other; |
| 839 } | 840 } |
| 840 } | 841 } |
| 841 return new HFieldSet(field, receiver, value); | 842 return new HFieldSet(field, receiver, value); |
| 842 } | 843 } |
| 843 | 844 |
| 845 HInstruction visitInvokeStatic(HInvokeStatic node) { | |
| 846 if (node.element == backend.getThrowConcurrentModificationError()) { | |
|
sra1
2015/04/16 19:27:09
If we agree on this general approach I will add an
| |
| 847 if (node.inputs.length == 2) { | |
| 848 HInstruction firstArgument = node.inputs[0]; | |
| 849 if (firstArgument is HConstant) { | |
| 850 HConstant constant = firstArgument; | |
| 851 if (constant.constant.isTrue) return constant; | |
| 852 } | |
| 853 } | |
| 854 } | |
| 855 return node; | |
| 856 } | |
| 857 | |
| 844 HInstruction visitStringConcat(HStringConcat node) { | 858 HInstruction visitStringConcat(HStringConcat node) { |
| 845 // Simplify string concat: | 859 // Simplify string concat: |
| 846 // | 860 // |
| 847 // "" + R -> R | 861 // "" + R -> R |
| 848 // L + "" -> L | 862 // L + "" -> L |
| 849 // "L" + "R" -> "LR" | 863 // "L" + "R" -> "LR" |
| 850 // (prefix + "L") + "R" -> prefix + "LR" | 864 // (prefix + "L") + "R" -> prefix + "LR" |
| 851 // | 865 // |
| 852 StringConstantValue getString(HInstruction instruction) { | 866 StringConstantValue getString(HInstruction instruction) { |
| 853 if (!instruction.isConstantString()) return null; | 867 if (!instruction.isConstantString()) return null; |
| (...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2265 | 2279 |
| 2266 keyedValues.forEach((receiver, values) { | 2280 keyedValues.forEach((receiver, values) { |
| 2267 result.keyedValues[receiver] = | 2281 result.keyedValues[receiver] = |
| 2268 new Map<HInstruction, HInstruction>.from(values); | 2282 new Map<HInstruction, HInstruction>.from(values); |
| 2269 }); | 2283 }); |
| 2270 | 2284 |
| 2271 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2285 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
| 2272 return result; | 2286 return result; |
| 2273 } | 2287 } |
| 2274 } | 2288 } |
| OLD | NEW |