Chromium Code Reviews| Index: lib/compiler/implementation/ssa/nodes.dart |
| =================================================================== |
| --- lib/compiler/implementation/ssa/nodes.dart (revision 7378) |
| +++ lib/compiler/implementation/ssa/nodes.dart (working copy) |
| @@ -930,6 +930,13 @@ |
| * so should always be generated at use site. |
| */ |
| bool isCodeMotionInvariant() => false; |
| + |
| + /** |
| + * Returns whether this instruction produces the same value as its |
| + * input. |
| + */ |
| + bool returnsInput() => false; |
|
Lasse Reichstein Nielsen
2012/05/08 12:39:08
returnsSingleInput?
Isn't our behavior here a lit
ngeoffray
2012/05/08 16:09:12
As discussed, to get the dependencies right. The c
|
| + HInstruction get input() => null; |
|
ngeoffray
2012/05/08 11:17:51
I could instead add a common super class for instr
Lasse Reichstein Nielsen
2012/05/08 12:39:08
What's the "input" getter for? Add comment, especi
floitsch
2012/05/08 13:21:42
I would prefer a common superclass or alternativel
ngeoffray
2012/05/08 16:09:12
I'm now using HCheck as the superclass of all thes
|
| } |
| class HBoolify extends HInstruction { |
| @@ -953,7 +960,9 @@ |
| // TODO(floitsch): make class abstract instead of adding an abstract method. |
| abstract accept(HVisitor visitor); |
| + HInstruction get input() => inputs[0]; |
| bool isControlFlow() => true; |
| + bool returnsInput() => true; |
| } |
| class HTypeGuard extends HInstruction { |
| @@ -968,6 +977,7 @@ |
| } |
| HInstruction get guarded() => inputs.last(); |
| + HInstruction get input() => guarded; |
|
Lasse Reichstein Nielsen
2012/05/08 12:39:08
Could you put the new methods in a somewhat consis
|
| HType computeTypeFromInputTypes() { |
| return isOn ? guardedType : guarded.propagatedType; |
| @@ -976,6 +986,7 @@ |
| HType get guaranteedType() => isOn ? guardedType : HType.UNKNOWN; |
| bool isControlFlow() => true; |
| + bool returnsInput() => true; |
| accept(HVisitor visitor) => visitor.visitTypeGuard(this); |
| int typeCode() => 1; |
| @@ -996,8 +1007,8 @@ |
| HBoundsCheck(length, index) : super(<HInstruction>[length, index]); |
| - HInstruction get length() => inputs[0]; |
| - HInstruction get index() => inputs[1]; |
| + HInstruction get length() => inputs[1]; |
| + HInstruction get index() => inputs[0]; |
| void prepareGvn() { |
| assert(!hasSideEffects()); |
| @@ -2158,6 +2169,10 @@ |
| HType get guaranteedType() => type; |
| accept(HVisitor visitor) => visitor.visitTypeConversion(this); |
| + |
| + HInstruction get input() => inputs[0]; |
| + bool returnsInput() => true; |
| + bool hasSideEffects() => checked; |
| } |
| /** |