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

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: ensure that not-null constraints are recomputed correctly 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..9663b3f11254ad3c41f5242bb525350fe94768e0 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);
@@ -590,7 +601,9 @@ void Definition::ReplaceWith(Definition* other,
BranchInstr::BranchInstr(ComparisonInstr* comparison, bool is_checked)
- : comparison_(comparison), is_checked_(is_checked) {
+ : comparison_(comparison),
+ is_checked_(is_checked),
+ constrained_type_(NULL) {
for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
comparison->InputAt(i)->set_instruction(this);
}
@@ -1308,6 +1321,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.
+ }
+
+
srdjan 2013/03/18 18:54:35 remove one line
Vyacheslav Egorov (Google) 2013/03/18 19:41:18 Done.
+ return this;
+}
+
+
Instruction* CheckSmiInstr::Canonicalize(FlowGraphOptimizer* optimizer) {
return (value()->Type()->ToCid() == kSmiCid) ? NULL : this;
}

Powered by Google App Engine
This is Rietveld 408576698