Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: runtime/vm/precompiler.cc

Issue 1900863002: Reapply "- Use a hash table to canonicalize instances/arrays to avoid having to iterate over a line… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698