Index: runtime/vm/constant_propagator.cc |
diff --git a/runtime/vm/constant_propagator.cc b/runtime/vm/constant_propagator.cc |
index 890f5408f24a18725fcd650a898ebe6652e42f48..004c4e68c253eedab0c80556d8a48e3809cbce10 100644 |
--- a/runtime/vm/constant_propagator.cc |
+++ b/runtime/vm/constant_propagator.cc |
@@ -783,10 +783,14 @@ void ConstantPropagator::VisitLoadClassId(LoadClassIdInstr* instr) { |
SetValue(instr, Smi::ZoneHandle(Z, Smi::New(cid))); |
return; |
} |
+ |
const Object& object = instr->object()->definition()->constant_value(); |
if (IsConstant(object)) { |
- SetValue(instr, Smi::ZoneHandle(Z, Smi::New(object.GetClassId()))); |
- return; |
+ cid = object.GetClassId(); |
+ if (CheckClassInstr::IsImmutableClassId(cid)) { |
+ SetValue(instr, Smi::ZoneHandle(Z, Smi::New(cid))); |
+ return; |
+ } |
} |
SetValue(instr, non_constant_); |
} |