Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart |
| index ba34bb2caab2694399cd3618b22f424c2c2616ac..c3b3806de9b49ce7ae34c1e78d851ef70ff8beb4 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart |
| @@ -816,6 +816,8 @@ abstract class HInstruction implements Spannable { |
| void setUseGvn() { _useGvn = true; } |
| void clearUseGvn() { _useGvn = false; } |
| + bool get isMovable => useGvn(); |
| + |
| /** |
| * A pure instruction is an instruction that does not have any side |
| * effect, nor any dependency. They can be moved anywhere in the |
| @@ -2471,9 +2473,19 @@ class HTypeConversion extends HCheck { |
| /// The [HTypeKnown] instruction marks a value with a refined type. |
| class HTypeKnown extends HCheck { |
| TypeMask knownType; |
| - HTypeKnown(TypeMask knownType, HInstruction input) |
| + bool _isMovable; |
| + |
| + HTypeKnown.pinned(TypeMask knownType, HInstruction input) |
| : this.knownType = knownType, |
| + this._isMovable = false, |
| super(<HInstruction>[input], knownType); |
| + |
| + HTypeKnown.witnessed(TypeMask knownType, HInstruction input, |
| + HInstruction witness) |
|
floitsch
2014/03/20 16:07:25
nit: I prefer aligning with the first argument.
herhut
2014/03/20 16:25:11
Done.
|
| + : this.knownType = knownType, |
| + this._isMovable = true, |
| + super(<HInstruction>[input, witness], knownType); |
| + |
| toString() => 'TypeKnown $knownType'; |
| accept(HVisitor visitor) => visitor.visitTypeKnown(this); |
| @@ -2484,6 +2496,7 @@ class HTypeKnown extends HCheck { |
| int typeCode() => HInstruction.TYPE_KNOWN_TYPECODE; |
| bool typeEquals(HInstruction other) => other is HTypeKnown; |
| bool isCodeMotionInvariant() => true; |
| + bool get isMovable => _isMovable && useGvn(); |
| bool dataEquals(HTypeKnown other) { |
| return knownType == other.knownType |
| @@ -2496,6 +2509,9 @@ class HRangeConversion extends HCheck { |
| : super(<HInstruction>[input], type) { |
| sourceElement = input.sourceElement; |
| } |
| + |
| + bool get isMovable => false; |
| + |
| accept(HVisitor visitor) => visitor.visitRangeConversion(this); |
| } |