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

Unified Diff: runtime/vm/object.cc

Issue 26331004: Use HasTypeArguments instead of first computing NumTypeArguments(); (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | « no previous file | 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 28346)
+++ runtime/vm/object.cc (working copy)
@@ -2556,10 +2556,10 @@
}
// Check for reflexivity.
if (raw() == other.raw()) {
- const intptr_t len = NumTypeArguments();
- if (len == 0) {
+ if (!HasTypeArguments()) {
return true;
}
+ const intptr_t len = NumTypeArguments();
// Since we do not truncate the type argument vector of a subclass (see
// below), we only check a prefix of the proper length.
// Check for covariance.
@@ -10610,10 +10610,11 @@
if (other.IsVoidType()) {
return false;
}
- const Class& cls = Class::Handle(clazz());
- AbstractTypeArguments& type_arguments = AbstractTypeArguments::Handle();
- const intptr_t num_type_arguments = cls.NumTypeArguments();
- if (num_type_arguments > 0) {
+ Isolate* isolate = Isolate::Current();
+ const Class& cls = Class::Handle(isolate, clazz());
+ AbstractTypeArguments& type_arguments =
+ AbstractTypeArguments::Handle(isolate);
+ if (cls.HasTypeArguments()) {
type_arguments = GetTypeArguments();
if (!type_arguments.IsNull() && !type_arguments.IsCanonical()) {
type_arguments = type_arguments.Canonicalize();
@@ -10628,14 +10629,15 @@
// 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));
+ (type_arguments.Length() >= cls.NumTypeArguments()));
}
- Class& other_class = Class::Handle();
- AbstractTypeArguments& other_type_arguments = AbstractTypeArguments::Handle();
+ Class& other_class = Class::Handle(isolate);
+ AbstractTypeArguments& other_type_arguments =
+ AbstractTypeArguments::Handle(isolate);
// Note that we may encounter a bound error in checked mode.
if (!other.IsInstantiated()) {
const AbstractType& instantiated_other = AbstractType::Handle(
- other.InstantiateFrom(other_instantiator, bound_error));
+ isolate, other.InstantiateFrom(other_instantiator, bound_error));
if ((bound_error != NULL) && !bound_error->IsNull()) {
ASSERT(FLAG_enable_type_checks);
return false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698