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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart

Issue 206553002: Prevent hoisting of certain check nodes, including [HTypeKnown]. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: take selector of type conversion into account in GVN Created 6 years, 9 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 | sdk/lib/_internal/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fdedd2a38b2969e099b9d55dda8ff9443faf529e 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
@@ -2464,16 +2466,27 @@ class HTypeConversion extends HCheck {
bool dataEquals(HTypeConversion other) {
return kind == other.kind
&& typeExpression == other.typeExpression
- && checkedType == other.checkedType;
+ && checkedType == other.checkedType
+ && receiverTypeCheckSelector == other.receiverTypeCheckSelector;
}
}
/// 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)
+ : this.knownType = knownType,
+ this._isMovable = true,
+ super(<HInstruction>[input, witness], knownType);
+
toString() => 'TypeKnown $knownType';
accept(HVisitor visitor) => visitor.visitTypeKnown(this);
@@ -2484,6 +2497,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 +2510,9 @@ class HRangeConversion extends HCheck {
: super(<HInstruction>[input], type) {
sourceElement = input.sourceElement;
}
+
+ bool get isMovable => false;
+
accept(HVisitor visitor) => visitor.visitRangeConversion(this);
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698