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

Unified Diff: runtime/vm/object.cc

Issue 14238036: Improve type optimization reusing the type argument vector of the instantiator (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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/object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 22056)
+++ runtime/vm/object.cc (working copy)
@@ -9023,16 +9023,16 @@
type_arguments = type_arguments.Canonicalize();
SetTypeArguments(type_arguments);
}
- // Verify that the number of type arguments in the instance matches the
- // number of type arguments expected by the instance class.
+ // The number of type arguments in the instance must be greater or equal to
+ // the number of type arguments expected by the instance class.
// A discrepancy is allowed for closures, which borrow the type argument
// vector of their instantiator, which may be of a subclass of the class
// defining the closure. Truncating the vector to the correct length on
// instantiation is unnecessary. The vector may therefore be longer.
+ // Also, an optimization reuses the type argument vector of the instantiator
+ // of generic instances when its layout is compatible.
ASSERT(type_arguments.IsNull() ||
- (type_arguments.Length() == num_type_arguments) ||
- (cls.IsSignatureClass() &&
- (type_arguments.Length() > num_type_arguments)));
+ (type_arguments.Length() >= num_type_arguments));
}
Class& other_class = Class::Handle();
AbstractTypeArguments& other_type_arguments = AbstractTypeArguments::Handle();
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698