Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: pkg/compiler/lib/src/ssa/nodes.dart

Issue 1079803002: Make HForeignCode 'isAllocation' property available to optimization (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
/**
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698