Chromium Code Reviews| Index: pkg/compiler/lib/src/ssa/nodes.dart |
| diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart |
| index d7be40ce86e154d05bd3188e2e6d6c6c29920e6e..5e144dd3351e4609467286986fc03fa4a70a6d7b 100644 |
| --- a/pkg/compiler/lib/src/ssa/nodes.dart |
| +++ b/pkg/compiler/lib/src/ssa/nodes.dart |
| @@ -842,6 +842,11 @@ abstract class HInstruction implements Spannable { |
| && !canThrow(); |
| } |
| + /// An instruction is an 'allocation' is it is the sole alias for an object. |
| + /// This applies to to instructions that allocate new objects and can be |
| + /// extended to methods that return other allocations without escaping them. |
| + bool isAllocation() => false; |
| + |
| /// Overridden by [HCheck] to return the actual non-[HCheck] |
| /// instruction it checks against. |
| HInstruction nonCheck() => this; |
| @@ -1751,6 +1756,10 @@ class HForeignCode extends HForeign { |
| bool isJsStatement() => isStatement; |
| bool canThrow() => throwBehavior.canThrow; |
| + |
| + bool isAllocation() => nativeBehavior != null && |
|
floitsch
2015/04/13 07:54:56
this is a getter name. -> should be a getter.
same
sra1
2015/04/13 17:12:43
Done. At first I thought I might need an argument
|
| + nativeBehavior.isAllocation && |
| + !canBeNull(); |
| } |
| class HForeignNew extends HForeign { |
| @@ -1767,6 +1776,8 @@ class HForeignNew extends HForeign { |
| : super(type, inputs); |
| accept(HVisitor visitor) => visitor.visitForeignNew(this); |
| + |
| + bool isAllocation() => true; |
| } |
| abstract class HInvokeBinary extends HInstruction { |
| @@ -2411,6 +2422,8 @@ class HLiteralList extends HInstruction { |
| HLiteralList(List<HInstruction> inputs, TypeMask type) : super(inputs, type); |
| toString() => 'literal list'; |
| accept(HVisitor visitor) => visitor.visitLiteralList(this); |
| + |
| + bool isAllocation() => true; |
| } |
| /** |