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

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 e00ca098c3bb8365fb9fd0a6425819671abd6550..473ef2f23bc94e1452a9bf82603b815b7ed853f3 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 get isAllocation => false;
+
/// Overridden by [HCheck] to return the actual non-[HCheck]
/// instruction it checks against.
HInstruction nonCheck() => this;
@@ -1755,6 +1760,10 @@ class HForeignCode extends HForeign {
: throwBehavior.onNonNull.canThrow;
bool onlyThrowsNSM() => throwBehavior.isOnlyNullNSMGuard;
+
+ bool get isAllocation => nativeBehavior != null &&
+ nativeBehavior.isAllocation &&
+ !canBeNull();
}
class HForeignNew extends HForeign {
@@ -1771,6 +1780,8 @@ class HForeignNew extends HForeign {
: super(type, inputs);
accept(HVisitor visitor) => visitor.visitForeignNew(this);
+
+ bool get isAllocation => true;
}
abstract class HInvokeBinary extends HInstruction {
@@ -2415,6 +2426,8 @@ class HLiteralList extends HInstruction {
HLiteralList(List<HInstruction> inputs, TypeMask type) : super(inputs, type);
toString() => 'literal list';
accept(HVisitor visitor) => visitor.visitLiteralList(this);
+
+ bool get 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