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