Chromium Code Reviews| Index: lib/compiler/implementation/ssa/nodes.dart |
| diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart |
| index f657bfcc4bbc28b8987838ea9aa22b6a44f0942a..05684bbb99d2bc90c20b79ac86fb3ddebf037889 100644 |
| --- a/lib/compiler/implementation/ssa/nodes.dart |
| +++ b/lib/compiler/implementation/ssa/nodes.dart |
| @@ -1490,8 +1490,6 @@ class HSubtract extends HBinaryArithmetic { |
| * An [HSwitch] instruction has one input for the incoming |
| * value, and one input per constant that it can switch on. |
| * Its block has one successor per constant, and one for the default. |
| - * If the switch didn't have a default case, the last successor is |
| - * the join block. |
| */ |
| class HSwitch extends HControlFlow { |
| HSwitch(List<HInstruction> inputs) : super(inputs); |
| @@ -1499,6 +1497,11 @@ class HSwitch extends HControlFlow { |
| HConstant constant(int index) => inputs[index + 1]; |
| HInstruction get expression() => inputs[0]; |
| + /** |
| + * Provides the target to jump to if none of the constants match |
| + * the expression. If the switc had no default case, this is the |
|
floitsch
2012/06/25 18:21:09
switch
Lasse Reichstein Nielsen
2012/06/26 08:26:03
Fixed.
|
| + * following join-block. |
| + */ |
| HBasicBlock get defaultTarget() => block.successors.last(); |
| accept(HVisitor visitor) => visitor.visitSwitch(this); |
| @@ -1832,7 +1835,7 @@ class HNot extends HInstruction { |
| * value from the start, whereas [HLocalValue]s need to be initialized first. |
| */ |
| class HLocalValue extends HInstruction { |
| - HLocalValue(element) : super(<HInstruction>[]) { |
| + HLocalValue(Element element) : super(<HInstruction>[]) { |
| sourceElement = element; |
| } |
| @@ -1845,7 +1848,7 @@ class HLocalValue extends HInstruction { |
| } |
| class HParameterValue extends HLocalValue { |
| - HParameterValue(element) : super(element); |
| + HParameterValue(Element element) : super(element); |
| toString() => 'parameter ${sourceElement.name}'; |
| accept(HVisitor visitor) => visitor.visitParameterValue(this); |
| @@ -2254,22 +2257,24 @@ class HTypeConversion extends HCheck { |
| static final int NO_CHECK = 0; |
| static final int CHECKED_MODE_CHECK = 1; |
| static final int ARGUMENT_TYPE_CHECK = 2; |
| + static final int CAST_TYPE_CHECK = 3; |
| - HTypeConversion(HType type, HInstruction input) |
| - : this.internal(type, input, NO_CHECK); |
| - HTypeConversion.checkedModeCheck(HType type, HInstruction input) |
| - : this.internal(type, input, CHECKED_MODE_CHECK); |
| - HTypeConversion.argumentTypeCheck(HType type, HInstruction input) |
| - : this.internal(type, input, ARGUMENT_TYPE_CHECK); |
| - |
| - HTypeConversion.internal(this.type, HInstruction input, this.kind) |
| + HTypeConversion(this.type, HInstruction input, [this.kind = NO_CHECK]) |
| : super(<HInstruction>[input]) { |
| sourceElement = input.sourceElement; |
| } |
| + HTypeConversion.checkedModeCheck(HType type, HInstruction input) |
| + : this(type, input, CHECKED_MODE_CHECK); |
| + HTypeConversion.argumentTypeCheck(HType type, HInstruction input) |
| + : this(type, input, ARGUMENT_TYPE_CHECK); |
| + HTypeConversion.castCheck(HType type, HInstruction input) |
| + : this(type, intpu, CAST_TYPE_CHECK); |
| + |
| - bool isChecked() => kind != NO_CHECK; |
| - bool isCheckedModeCheck() => kind == CHECKED_MODE_CHECK; |
| - bool isArgumentTypeCheck() => kind == ARGUMENT_TYPE_CHECK; |
| + bool get isChecked() => kind != NO_CHECK; |
| + bool get isCheckedModeCheck() => kind == CHECKED_MODE_CHECK; |
| + bool get isArgumentTypeCheck() => kind == ARGUMENT_TYPE_CHECK; |
| + bool get isCastTypeCheck() => kind == CAST_TYPE_CHECK; |
| HType get guaranteedType() => type; |
| @@ -2279,7 +2284,9 @@ class HTypeConversion extends HCheck { |
| bool isControlFlow() => kind == ARGUMENT_TYPE_CHECK; |
| int typeCode() => 28; |
| - bool typeEquals(HInstruction other) => other is HTypeConversion; |
| + bool typeEquals(HInstruction other) |
| + => other is HTypeConversion |
|
floitsch
2012/06/25 18:21:09
use { } instead of "=>".
|
| + && ((other.kind == CAST_TYPE_CHECK) == (kind == CAST_TYPE_CHECK)); |
|
floitsch
2012/06/25 18:21:09
Explain why only CAST_TYPE_CHECKs are the same.
Lasse Reichstein Nielsen
2012/06/26 08:26:03
Non-casts would also be the same. I don't think I
|
| bool dataEquals(HTypeConversion other) { |
| return type == other.type && kind == other.kind; |
| } |