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

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: 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
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);
}

Powered by Google App Engine
This is Rietveld 408576698