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

Unified Diff: runtime/vm/precompiler.cc

Issue 1405253004: Precompilation: Including generative constructor entry points should mark a class as instantiated. (Closed) Base URL: git@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
« no previous file with comments | « 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 23b67b1dcc4a7c1661c849bfa38a8fa13022ee2a..e6b60498b87cc5b2bf39cd887d1ad244a440f769 100644
--- a/runtime/vm/precompiler.cc
+++ b/runtime/vm/precompiler.cc
@@ -186,7 +186,7 @@ void Precompiler::AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]) {
Class& cls = Class::Handle(Z);
for (intptr_t i = 0; kExternallyAllocatedCids[i] != kIllegalCid; i++) {
cls = isolate()->class_table()->At(kExternallyAllocatedCids[i]);
- AddClass(cls);
+ AddInstantiatedClass(cls);
}
Dart_QualifiedFunctionName vm_entry_points[] = {
@@ -282,6 +282,13 @@ void Precompiler::AddEntryPoints(Dart_QualifiedFunctionName entry_points[]) {
}
AddFunction(func);
+ if (func.IsGenerativeConstructor()) {
+ // Allocation stubs are referenced from the call site of the constructor,
+ // not in the constructor itself. So compiling the constructor isn't
+ // enough for us to discover the class is instantiated if the class isn't
+ // otherwise instantiated from Dart code and only instantiated from C++.
+ AddInstantiatedClass(cls);
+ }
}
}
@@ -395,7 +402,7 @@ void Precompiler::AddCalleesOf(const Function& function) {
target_code ^= entry.raw();
if (target_code.IsAllocationStubCode()) {
cls ^= target_code.owner();
- AddClass(cls);
+ AddInstantiatedClass(cls);
}
}
}
@@ -405,7 +412,7 @@ void Precompiler::AddCalleesOf(const Function& function) {
void Precompiler::AddConstObject(const Instance& instance) {
const Class& cls = Class::Handle(Z, instance.clazz());
- AddClass(cls);
+ AddInstantiatedClass(cls);
if (instance.IsClosure()) {
// An implicit static closure.
@@ -530,7 +537,7 @@ void Precompiler::AddSelector(const String& selector) {
}
-void Precompiler::AddClass(const Class& cls) {
+void Precompiler::AddInstantiatedClass(const Class& cls) {
if (cls.is_allocated()) return;
class_count_++;
@@ -543,7 +550,7 @@ void Precompiler::AddClass(const Class& cls) {
const Class& superclass = Class::Handle(cls.SuperClass());
if (!superclass.IsNull()) {
- AddClass(superclass);
+ AddInstantiatedClass(superclass);
}
}
« no previous file with comments | « runtime/vm/precompiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698