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