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 interface HVisitor<R> { | 5 interface HVisitor<R> { |
| 6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
| 7 R visitBailoutTarget(HBailoutTarget node); | 7 R visitBailoutTarget(HBailoutTarget node); |
| 8 R visitBitAnd(HBitAnd node); | 8 R visitBitAnd(HBitAnd node); |
| 9 R visitBitNot(HBitNot node); | 9 R visitBitNot(HBitNot node); |
| 10 R visitBitOr(HBitOr node); | 10 R visitBitOr(HBitOr node); |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1112 class HIntegerCheck extends HCheck { | 1112 class HIntegerCheck extends HCheck { |
| 1113 bool alwaysFalse = false; | 1113 bool alwaysFalse = false; |
| 1114 | 1114 |
| 1115 HIntegerCheck(value) : super(<HInstruction>[value]); | 1115 HIntegerCheck(value) : super(<HInstruction>[value]); |
| 1116 | 1116 |
| 1117 HInstruction get value() => inputs[0]; | 1117 HInstruction get value() => inputs[0]; |
| 1118 bool isControlFlow() => true; | 1118 bool isControlFlow() => true; |
| 1119 | 1119 |
| 1120 HType get guaranteedType() => HType.INTEGER; | 1120 HType get guaranteedType() => HType.INTEGER; |
| 1121 | 1121 |
| 1122 HType computeDesiredTypeForInput(HInstruction input, HTypeMap types) { | |
| 1123 // If the desired type of the input is already a number, we want | |
| 1124 // to specialize it to an integer. | |
| 1125 if (input.isNumber(types)) return HType.INTEGER; | |
|
kasperl
2012/08/21 05:36:00
Maybe rewrite using ?:
ngeoffray
2012/08/21 07:38:41
Done.
| |
| 1126 return super.computeDesiredTypeForInput(input, types); | |
| 1127 } | |
| 1128 | |
| 1122 accept(HVisitor visitor) => visitor.visitIntegerCheck(this); | 1129 accept(HVisitor visitor) => visitor.visitIntegerCheck(this); |
| 1123 int typeCode() => 3; | 1130 int typeCode() => 3; |
| 1124 bool typeEquals(other) => other is HIntegerCheck; | 1131 bool typeEquals(other) => other is HIntegerCheck; |
| 1125 bool dataEquals(HInstruction other) => true; | 1132 bool dataEquals(HInstruction other) => true; |
| 1126 } | 1133 } |
| 1127 | 1134 |
| 1128 class HConditionalBranch extends HControlFlow { | 1135 class HConditionalBranch extends HControlFlow { |
| 1129 HConditionalBranch(inputs) : super(inputs); | 1136 HConditionalBranch(inputs) : super(inputs); |
| 1130 HInstruction get condition() => inputs[0]; | 1137 HInstruction get condition() => inputs[0]; |
| 1131 HBasicBlock get trueBranch() => block.successors[0]; | 1138 HBasicBlock get trueBranch() => block.successors[0]; |
| (...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2743 HBasicBlock get start() => expression.start; | 2750 HBasicBlock get start() => expression.start; |
| 2744 HBasicBlock get end() { | 2751 HBasicBlock get end() { |
| 2745 // We don't create a switch block if there are no cases. | 2752 // We don't create a switch block if there are no cases. |
| 2746 assert(!statements.isEmpty()); | 2753 assert(!statements.isEmpty()); |
| 2747 return statements.last().end; | 2754 return statements.last().end; |
| 2748 } | 2755 } |
| 2749 | 2756 |
| 2750 bool accept(HStatementInformationVisitor visitor) => | 2757 bool accept(HStatementInformationVisitor visitor) => |
| 2751 visitor.visitSwitchInfo(this); | 2758 visitor.visitSwitchInfo(this); |
| 2752 } | 2759 } |
| OLD | NEW |