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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 14021016: Track side-effect free paths in the graph to allow CSE and LICM for instructions that depend on som… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index ea389c7cebcfbc8bf73e848bbecec5a335077668..db496121a2121891632312decd4853cb9286186e 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -103,11 +103,12 @@ bool CheckClassInstr::AttributesEqual(Instruction* other) const {
}
-bool CheckClassInstr::AffectedBySideEffect() const {
- // The class-id of string objects is not invariant: Externalization of strings
- // via the API can change the class-id.
- return unary_checks().HasReceiverClassId(kOneByteStringCid)
- || unary_checks().HasReceiverClassId(kTwoByteStringCid);
+EffectSet CheckClassInstr::Dependencies() const {
+ // Externalization of strings via the API can change the class-id.
+ const bool externalizable =
+ unary_checks().HasReceiverClassId(kOneByteStringCid) ||
+ unary_checks().HasReceiverClassId(kTwoByteStringCid);
+ return externalizable ? EffectSet::Externalization() : EffectSet::None();
}
@@ -116,11 +117,6 @@ bool GuardFieldInstr::AttributesEqual(Instruction* other) const {
}
-bool GuardFieldInstr::AffectedBySideEffect() const {
- return false;
-}
-
-
bool CheckArrayBoundInstr::AttributesEqual(Instruction* other) const {
CheckArrayBoundInstr* other_check = other->AsCheckArrayBound();
ASSERT(other_check != NULL);
@@ -153,6 +149,11 @@ bool BinarySmiOpInstr::AttributesEqual(Instruction* other) const {
}
+EffectSet LoadFieldInstr::Dependencies() const {
+ return immutable_ ? EffectSet::None() : EffectSet::All();
+}
+
+
bool LoadFieldInstr::AttributesEqual(Instruction* other) const {
LoadFieldInstr* other_load = other->AsLoadField();
ASSERT(other_load != NULL);
@@ -162,6 +163,11 @@ bool LoadFieldInstr::AttributesEqual(Instruction* other) const {
}
+EffectSet LoadStaticFieldInstr::Dependencies() const {
+ return field().is_final() ? EffectSet::None() : EffectSet::All();
+}
+
+
bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const {
LoadStaticFieldInstr* other_load = other->AsLoadStaticField();
ASSERT(other_load != NULL);
@@ -172,6 +178,11 @@ bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const {
}
+EffectSet LoadIndexedInstr::Dependencies() const {
+ return EffectSet::All();
+}
+
+
bool LoadIndexedInstr::AttributesEqual(Instruction* other) const {
LoadIndexedInstr* other_load = other->AsLoadIndexed();
ASSERT(other_load != NULL);
@@ -1710,8 +1721,10 @@ static bool AreEqualDefinitions(Definition* a, Definition* b) {
a = UnwrapConstraint(a);
b = UnwrapConstraint(b);
return (a == b) ||
- (!a->AffectedBySideEffect() &&
- !b->AffectedBySideEffect() &&
+ (a->AllowsCSE() &&
+ a->Dependencies().IsNone() &&
+ b->AllowsCSE() &&
+ b->Dependencies().IsNone() &&
a->Equals(b));
}
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698