Index: runtime/vm/precompiler.cc |
diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc |
index 3819070471ff96a03d17fee6c70f9fb66b5e383d..6cf0736eb4bb07a18fcea4d6aa1a56be94df8340 100644 |
--- a/runtime/vm/precompiler.cc |
+++ b/runtime/vm/precompiler.cc |
@@ -1483,15 +1483,21 @@ void Precompiler::TraceTypesFromRetainedClasses() { |
retained_constants.Add(constant); |
} |
} |
- if (retained_constants.Length() > 0) { |
+ intptr_t cid = cls.id(); |
+ if ((cid == kMintCid) || (cid == kBigintCid) || (cid == kDoubleCid)) { |
+ // Constants stored as a plain list, no rehashing needed. |
constants = Array::MakeArray(retained_constants); |
cls.set_constants(constants); |
} else { |
- constants = Object::empty_array().raw(); |
+ // Rehash. |
cls.set_constants(Object::empty_array()); |
+ for (intptr_t j = 0; j < retained_constants.Length(); j++) { |
+ constant ^= retained_constants.At(j); |
+ cls.InsertCanonicalConstant(Z, constant); |
+ } |
} |
- if (constants.Length() > 0) { |
+ if (retained_constants.Length() > 0) { |
ASSERT(retain); // This shouldn't be the reason we keep a class. |
retain = true; |
} |