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

Unified Diff: runtime/vm/class_finalizer.cc

Issue 15689012: More cleanup to avoid creation of redundant handles (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | runtime/vm/object.h » ('j') | runtime/vm/object.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_finalizer.cc
===================================================================
--- runtime/vm/class_finalizer.cc (revision 23498)
+++ runtime/vm/class_finalizer.cc (working copy)
@@ -97,9 +97,11 @@
super_type = cls.super_type();
if (!super_type.IsNull()) {
if (!super_type.IsMalformed() &&
- super_type.HasResolvedTypeClass() &&
- Class::Handle(super_type.type_class()).is_finalized()) {
- AddSuperType(super_type, finalized_super_classes);
+ super_type.HasResolvedTypeClass()) {
+ cls ^= super_type.type_class();
+ if (cls.is_finalized()) {
+ AddSuperType(super_type, finalized_super_classes);
+ }
}
}
}
@@ -374,7 +376,8 @@
// Update redirection data with resolved target.
factory.SetRedirectionTarget(target);
- factory.SetRedirectionIdentifier(String::Handle()); // Not needed anymore.
+ // Not needed anymore.
+ factory.SetRedirectionIdentifier(String::null_object());
if (!target.IsRedirectingFactory()) {
return;
}
@@ -882,7 +885,7 @@
parameterized_type_name.ToCString()));
return BoundedType::New(parameterized_type,
malformed_bound,
- TypeParameter::Handle());
+ TypeParameter::null_object());
}
if (finalization >= kCanonicalize) {
@@ -1438,6 +1441,7 @@
// Finalize interface types (but not necessarily interface classes).
Array& interface_types = Array::Handle(cls.interfaces());
AbstractType& interface_type = AbstractType::Handle();
+ AbstractType& seen_interf = AbstractType::Handle();
for (intptr_t i = 0; i < interface_types.Length(); i++) {
interface_type ^= interface_types.At(i);
interface_type = FinalizeType(cls, interface_type, kCanonicalizeWellFormed);
@@ -1456,7 +1460,6 @@
String::Handle(super_type.Name()).ToCString(),
String::Handle(cls.Name()).ToCString());
}
- AbstractType& seen_interf = AbstractType::Handle();
for (intptr_t j = 0; j < i; j++) {
seen_interf ^= interface_types.At(j);
if (interface_type.Equals(seen_interf)) {
@@ -1623,10 +1626,11 @@
ASSERT(type.IsType());
CollectTypeArguments(cls, Type::Cast(type), type_args);
const Array& mixins = Array::Handle(mixin_app.mixin_types());
+ Class& mixin_app_class = Class::Handle();
for (int i = 0; i < mixins.Length(); i++) {
type ^= mixins.At(i);
ASSERT(type.HasResolvedTypeClass()); // Newly created class in parser.
- const Class& mixin_app_class = Class::Handle(type.type_class());
+ mixin_app_class ^= type.type_class();
type = mixin_app_class.mixin();
ASSERT(!type.IsNull());
ResolveType(cls, type, kCanonicalizeWellFormed);
@@ -1650,12 +1654,10 @@
// mixin types. This super type replaces the MixinAppType object
// in the class that extends the mixin application.
type ^= mixins.At(mixins.Length() - 1);
- const Class& resolved_mixin_app_class = Class::Handle(type.type_class());
- Type& resolved_mixin_app_type = Type::Handle();
- resolved_mixin_app_type = Type::New(resolved_mixin_app_class,
- mixin_app_args,
- mixin_app.token_pos());
- return resolved_mixin_app_type.raw();
+ mixin_app_class ^= type.type_class();
+ return Type::New(mixin_app_class,
+ mixin_app_args,
+ mixin_app.token_pos());
}
@@ -1915,7 +1917,7 @@
if (FLAG_enable_type_checks || !type.HasResolvedTypeClass()) {
type.set_malformed_error(error);
}
- type.set_arguments(AbstractTypeArguments::Handle());
+ type.set_arguments(AbstractTypeArguments::null_object());
if (!type.IsFinalized()) {
type.SetIsFinalized();
// Do not canonicalize malformed types, since they may not be resolved.
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698