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 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1030 | 1030 |
1031 class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase { | 1031 class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase { |
1032 final String name = "SsaDeadCodeEliminator"; | 1032 final String name = "SsaDeadCodeEliminator"; |
1033 | 1033 |
1034 final Compiler compiler; | 1034 final Compiler compiler; |
1035 final SsaOptimizerTask optimizer; | 1035 final SsaOptimizerTask optimizer; |
1036 SsaLiveBlockAnalyzer analyzer; | 1036 SsaLiveBlockAnalyzer analyzer; |
1037 Map<HInstruction, bool> trivialDeadStoreReceivers = | 1037 Map<HInstruction, bool> trivialDeadStoreReceivers = |
1038 new Maplet<HInstruction, bool>(); | 1038 new Maplet<HInstruction, bool>(); |
1039 bool eliminatedSideEffects = false; | 1039 bool eliminatedSideEffects = false; |
1040 JavaScriptBackend get backend => compiler.backend; | |
karlklose
2015/05/28 09:39:53
Is this getter used?
herhut
2015/06/01 12:09:42
Thanks! Not anymore...
| |
1041 | |
1040 SsaDeadCodeEliminator(this.compiler, this.optimizer); | 1042 SsaDeadCodeEliminator(this.compiler, this.optimizer); |
1041 | 1043 |
1042 HInstruction zapInstructionCache; | 1044 HInstruction zapInstructionCache; |
1043 HInstruction get zapInstruction { | 1045 HInstruction get zapInstruction { |
1044 if (zapInstructionCache == null) { | 1046 if (zapInstructionCache == null) { |
1045 // A constant with no type does not pollute types at phi nodes. | 1047 // A constant with no type does not pollute types at phi nodes. |
1046 ConstantValue constant = | 1048 ConstantValue constant = |
1047 new DummyConstantValue(const TypeMask.nonNullEmpty()); | 1049 new DummyConstantValue( |
1050 DummyConstantKinds.emptyValue, | |
1051 const TypeMask.nonNullEmpty()); | |
1048 zapInstructionCache = analyzer.graph.addConstant(constant, compiler); | 1052 zapInstructionCache = analyzer.graph.addConstant(constant, compiler); |
1049 } | 1053 } |
1050 return zapInstructionCache; | 1054 return zapInstructionCache; |
1051 } | 1055 } |
1052 | 1056 |
1053 /// Returns true of [foreign] will throw an noSuchMethod error if | 1057 /// Returns true of [foreign] will throw an noSuchMethod error if |
1054 /// receiver is `null` before having any other side-effects. | 1058 /// receiver is `null` before having any other side-effects. |
1055 bool templateThrowsNSMonNull(HForeignCode foreign, HInstruction receiver) { | 1059 bool templateThrowsNSMonNull(HForeignCode foreign, HInstruction receiver) { |
1056 if (foreign.inputs.length < 1) return false; | 1060 if (foreign.inputs.length < 1) return false; |
1057 if (foreign.inputs.first != receiver) return false; | 1061 if (foreign.inputs.first != receiver) return false; |
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2295 | 2299 |
2296 keyedValues.forEach((receiver, values) { | 2300 keyedValues.forEach((receiver, values) { |
2297 result.keyedValues[receiver] = | 2301 result.keyedValues[receiver] = |
2298 new Map<HInstruction, HInstruction>.from(values); | 2302 new Map<HInstruction, HInstruction>.from(values); |
2299 }); | 2303 }); |
2300 | 2304 |
2301 result.nonEscapingReceivers.addAll(nonEscapingReceivers); | 2305 result.nonEscapingReceivers.addAll(nonEscapingReceivers); |
2302 return result; | 2306 return result; |
2303 } | 2307 } |
2304 } | 2308 } |
OLD | NEW |