Index: lib/compiler/implementation/ssa/nodes.dart |
diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart |
index 9157093859f7d1bbc32bb8b6036bb8199ea90e6d..138e78ab3e4cf50649fef89e3f1dd26eef3b7edb 100644 |
--- a/lib/compiler/implementation/ssa/nodes.dart |
+++ b/lib/compiler/implementation/ssa/nodes.dart |
@@ -1489,8 +1489,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); |
@@ -1498,6 +1496,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 |
+ * following join-block. |
+ */ |
HBasicBlock get defaultTarget() => block.successors.last(); |
accept(HVisitor visitor) => visitor.visitSwitch(this); |
@@ -1813,7 +1816,7 @@ class HNot extends HInstruction { |
} |
class HParameterValue extends HInstruction { |
- HParameterValue(element) : super(<HInstruction>[]) { |
+ HParameterValue(Element element) : super(<HInstruction>[]) { |
sourceElement = element; |
} |
@@ -2220,16 +2223,28 @@ class HIs extends HInstruction { |
} |
class HTypeConversion extends HCheck { |
+ static final int UNCHECKED = 0; |
+ static final int CHECKED = 1; |
+ static final int CAST = 2; |
+ |
HType type; |
- final bool checked; |
+ final int kind; |
HTypeConversion(HType this.type, |
HInstruction input, |
- [bool this.checked = false]) |
+ [this.kind = UNCHECKED]) |
: super(<HInstruction>[input]) { |
sourceElement = input.sourceElement; |
} |
+ bool get checked() => kind != UNCHECKED; |
+ /** |
+ * Whether to use cast-semantics instead of checked-mode assignment semantics |
+ * for the conversion. The difference is that a cast throws on [:null:] and |
+ * throws a different exception on a failed match. |
+ */ |
+ bool get isCast() => kind == CAST; |
+ |
HType get guaranteedType() => type; |
accept(HVisitor visitor) => visitor.visitTypeConversion(this); |