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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 165523002: Avoid repeated resolution of types by marking them as resolved. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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/class_finalizer.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_finalizer.cc
===================================================================
--- runtime/vm/class_finalizer.cc (revision 32680)
+++ runtime/vm/class_finalizer.cc (working copy)
@@ -305,7 +305,6 @@
OS::Print("Resolving redirecting factory: %s\n",
String::Handle(factory.name()).ToCString());
}
- ResolveType(cls, type);
type ^= FinalizeType(cls, type, kCanonicalize);
factory.SetRedirectionType(type);
if (type.IsMalformedOrMalbounded()) {
@@ -461,16 +460,21 @@
void ClassFinalizer::ResolveType(const Class& cls, const AbstractType& type) {
- // TODO(regis): Add a kResolved bit in type_state_ for efficiency.
- if (type.IsFinalized() || type.IsResolved()) {
+ if (type.IsResolved()) {
return;
}
+ ASSERT(type.IsType());
if (FLAG_trace_type_finalization) {
OS::Print("Resolve type '%s'\n", String::Handle(type.Name()).ToCString());
}
-
ResolveTypeClass(cls, type);
-
+ if (type.IsMalformed()) {
+ ASSERT(type.IsResolved());
+ return;
+ }
+ // Mark type as resolved before resolving its type arguments in order to avoid
+ // repeating resolution of recursive types.
+ Type::Cast(type).set_is_resolved();
// Resolve type arguments, if any.
const TypeArguments& arguments = TypeArguments::Handle(type.arguments());
if (!arguments.IsNull()) {
@@ -768,7 +772,7 @@
return TypeRef::New(type);
}
- ASSERT(type.IsResolved());
+ ResolveType(cls, type);
if (FLAG_trace_type_finalization) {
OS::Print("Finalizing type '%s' for class '%s'\n",
String::Handle(type.Name()).ToCString(),
@@ -990,7 +994,6 @@
AbstractType& type = AbstractType::Handle(function.result_type());
// It is not a compile time error if this name does not resolve to a class or
// interface.
- ResolveType(cls, type);
type = FinalizeType(cls, type, kCanonicalize);
// The result type may be malformed or malbounded.
function.set_result_type(type);
@@ -998,7 +1001,6 @@
const intptr_t num_parameters = function.NumParameters();
for (intptr_t i = 0; i < num_parameters; i++) {
type = function.ParameterTypeAt(i);
- ResolveType(cls, type);
type = FinalizeType(cls, type, kCanonicalize);
// The parameter type may be malformed or malbounded.
function.SetParameterTypeAt(i, type);
@@ -1127,7 +1129,6 @@
for (intptr_t i = 0; i < num_fields; i++) {
field ^= array.At(i);
type = field.type();
- ResolveType(cls, type);
type = FinalizeType(cls, type, kCanonicalize);
field.set_type(type);
name = field.name();
« no previous file with comments | « runtime/vm/class_finalizer.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698