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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 838863004: Handle LoadClassId(obj) === cid during type propagation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 80843b78f8eb96dab1b0e2dcdc639cb065a7caba..36083703746b1d51f3d235f8c44d6dee5ebdbded 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -152,20 +152,42 @@ bool CheckClassInstr::AttributesEqual(Instruction* other) const {
}
+bool CheckClassInstr::IsImmutableClassId(intptr_t cid) {
+ switch (cid) {
+ case kOneByteStringCid:
+ case kTwoByteStringCid:
+ return false;
+ default:
+ return true;
+ }
+}
+
+
+static bool AreAllChecksImmutable(const ICData& checks) {
+ const intptr_t len = checks.NumberOfChecks();
+ for (intptr_t i = 0; i < len; i++) {
+ if (checks.IsUsedAt(i)) {
+ if (!CheckClassInstr::IsImmutableClassId(
+ checks.GetReceiverClassIdAt(i))) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+
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();
+ return !AreAllChecksImmutable(unary_checks()) ?
+ EffectSet::Externalization() : EffectSet::None();
}
EffectSet CheckClassIdInstr::Dependencies() const {
// Externalization of strings via the API can change the class-id.
- const bool externalizable =
- cid_ == kOneByteStringCid || cid_ == kTwoByteStringCid;
- return externalizable ? EffectSet::Externalization() : EffectSet::None();
+ return !CheckClassInstr::IsImmutableClassId(cid_) ?
+ EffectSet::Externalization() : EffectSet::None();
}
« 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