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

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: 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
« runtime/vm/object.cc ('K') | « runtime/vm/precompiler.h ('k') | no next file » | 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 d2d0ef01bc064c4cf65eec399456ea59e3173d33..6360c30df8cc108bc582ac530eaf2b8a99bbe3dc 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())
@@ -71,6 +72,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);
@@ -812,4 +817,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(thread());
rmacnak 2015/10/14 16:38:48 T, since you added it.
srdjan 2015/10/14 16:51:58 Done.
+ }
+ }
+ I->set_all_classes_finalized(true);
+}
+
+
} // namespace dart
« runtime/vm/object.cc ('K') | « runtime/vm/precompiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698