Index: runtime/vm/constant_propagator.cc |
diff --git a/runtime/vm/constant_propagator.cc b/runtime/vm/constant_propagator.cc |
index 3e3831dda45310a7c86d3244ea7c3df0500da0ce..050c0ba2a99606affbf530fab27dbd375b478f8f 100644 |
--- a/runtime/vm/constant_propagator.cc |
+++ b/runtime/vm/constant_propagator.cc |
@@ -831,33 +831,30 @@ void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) { |
} |
} |
- const Object& constant = instance->definition()->constant_value(); |
- if (IsConstant(constant)) { |
- if (instr->IsImmutableLengthLoad()) { |
- if (constant.IsString()) { |
+ if (instr->IsImmutableLengthLoad()) { |
+ ConstantInstr* constant = |
+ instance->definition()->OriginalDefinition()->AsConstant(); |
+ if (constant != NULL) { |
+ if (constant->value().IsString()) { |
SetValue(instr, |
- Smi::ZoneHandle(Z, Smi::New(String::Cast(constant).Length()))); |
+ Smi::ZoneHandle( |
+ Z, Smi::New(String::Cast(constant->value()).Length()))); |
return; |
} |
- if (constant.IsArray()) { |
+ if (constant->value().IsArray()) { |
SetValue(instr, |
- Smi::ZoneHandle(Z, Smi::New(Array::Cast(constant).Length()))); |
+ Smi::ZoneHandle( |
+ Z, Smi::New(Array::Cast(constant->value()).Length()))); |
return; |
} |
- if (constant.IsTypedData()) { |
- SetValue(instr, Smi::ZoneHandle( |
- Z, Smi::New(TypedData::Cast(constant).Length()))); |
- return; |
- } |
- } else { |
- Object& value = Object::Handle(); |
- if (instr->Evaluate(constant, &value)) { |
- SetValue(instr, Object::ZoneHandle(Z, value.raw())); |
+ if (constant->value().IsTypedData()) { |
+ SetValue(instr, |
+ Smi::ZoneHandle( |
+ Z, Smi::New(TypedData::Cast(constant->value()).Length()))); |
return; |
} |
} |
} |
- |
SetValue(instr, non_constant_); |
} |