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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 12529008: Collect type feedback for fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rewritten instruction pattern on ia32 Created 7 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: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 40300289f755dd02f357971572cb69af70d9e761..0e7b76db41c6256ab938893f9ac1f818527a47f4 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -69,7 +69,8 @@ bool Value::Equals(Value* other) const {
CheckClassInstr::CheckClassInstr(Value* value,
intptr_t deopt_id,
const ICData& unary_checks)
- : unary_checks_(unary_checks) {
+ : unary_checks_(unary_checks),
+ null_check_(false) {
ASSERT(unary_checks.IsZoneHandle());
// Expected useful check data.
ASSERT(!unary_checks_.IsNull());
@@ -109,6 +110,16 @@ bool CheckClassInstr::AffectedBySideEffect() const {
}
+bool GuardFieldInstr::AttributesEqual(Instruction* other) const {
+ return field().raw() == other->AsGuardField()->field().raw();
+}
+
+
+bool GuardFieldInstr::AffectedBySideEffect() const {
+ return false;
+}
+
+
bool CheckArrayBoundInstr::AttributesEqual(Instruction* other) const {
CheckArrayBoundInstr* other_check = other->AsCheckArrayBound();
ASSERT(other_check != NULL);
@@ -1308,6 +1319,26 @@ Instruction* CheckClassInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
}
+Instruction* GuardFieldInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
+ if (field().guarded_cid() == kDynamicCid) {
+ return NULL; // Nothing to guard.
+ }
+
+ if (field().is_nullable() && value()->Type()->IsNull()) {
+ return NULL;
+ }
+
+ const intptr_t cid = field().is_nullable() ? value()->Type()->ToNullableCid()
+ : value()->Type()->ToCid();
+ if (field().guarded_cid() == cid) {
+ return NULL; // Value is guaranteed to have this cid.
+ }
+
+
+ return this;
+}
+
+
Instruction* CheckSmiInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
return (value()->Type()->ToCid() == kSmiCid) ? NULL : this;
}

Powered by Google App Engine
This is Rietveld 408576698