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

Unified Diff: runtime/vm/precompiler.cc

Issue 1392893003: In precompilation, finalize all classes eagerly. Use the stable class hierarchy for doing CHA based… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Sync Created 5 years, 2 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/precompiler.h ('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 f061da02c6905080a973bca7316e9dec985b45da..7000601bc549cc3da0aa236ab80d47122d4d798b 100644
--- a/runtime/vm/precompiler.cc
+++ b/runtime/vm/precompiler.cc
@@ -17,6 +17,7 @@
namespace dart {
+#define T (thread())
#define I (isolate())
#define Z (zone())
@@ -73,6 +74,10 @@ void Precompiler::DoCompileAll(
// that we have already looked for the function's callees.
ClearAllCode();
+ // Make sure class hierarchy is stable before compilation so that CHA
+ // can be used.
+ FinalizeAllClasses();
+
// Start with the allocations and invocations that happen from C++.
AddRoots(embedder_entry_points);
@@ -824,4 +829,24 @@ void Precompiler::VisitFunctions(FunctionVisitor* visitor) {
}
}
+
+void Precompiler::FinalizeAllClasses() {
+ Library& lib = Library::Handle(Z);
+ Class& cls = Class::Handle(Z);
+
+ for (intptr_t i = 0; i < libraries_.Length(); i++) {
+ lib ^= libraries_.At(i);
+ ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
+ while (it.HasNext()) {
+ cls = it.GetNextClass();
+ if (cls.IsDynamicClass()) {
+ continue; // class 'dynamic' is in the read-only VM isolate.
+ }
+ cls.EnsureIsFinalized(T);
+ }
+ }
+ I->set_all_classes_finalized(true);
+}
+
+
} // namespace dart
« no previous file with comments | « runtime/vm/precompiler.h ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698