Chromium Code Reviews| Index: runtime/vm/object.cc |
| =================================================================== |
| --- runtime/vm/object.cc (revision 28104) |
| +++ runtime/vm/object.cc (working copy) |
| @@ -1709,16 +1709,15 @@ |
| // resolved, which is checked by the type_class() call on the super type. |
| // Note that calling type_class() on a MixinAppType fails. |
| Isolate* isolate = Isolate::Current(); |
| - ReusableHandleScope reused_handles(isolate); |
| - Class& cls = reused_handles.ClassHandle(); |
| - TypeArguments& type_params = reused_handles.TypeArgumentsHandle(); |
| - AbstractType& sup_type = reused_handles.AbstractTypeHandle(); |
| + Class& cls = Class::Handle(isolate); |
|
Ivan Posva
2013/10/01 18:50:04
Why was this changed?
regis
2013/10/01 19:11:58
We were just lucky before. NumTypeArguments() is r
|
| + TypeArguments& type_params = TypeArguments::Handle(isolate); |
| + AbstractType& sup_type = AbstractType::Handle(isolate); |
| cls ^= raw(); |
| intptr_t num_type_args = 0; |
| do { |
| if (cls.IsSignatureClass()) { |
| - Function& signature_fun = reused_handles.FunctionHandle(); |
| + Function& signature_fun = Function::Handle(isolate); |
| signature_fun ^= cls.signature_function(); |
| if (!signature_fun.is_static() && |
| !signature_fun.HasInstantiatedSignature()) { |
| @@ -3429,6 +3428,20 @@ |
| } |
| +bool TypeArguments::IsFinalized() const { |
| + ASSERT(!IsNull()); |
| + AbstractType& type = AbstractType::Handle(); |
| + const intptr_t num_types = Length(); |
| + for (intptr_t i = 0; i < num_types; i++) { |
| + type = TypeAt(i); |
| + if (!type.IsFinalized()) { |
| + return false; |
| + } |
| + } |
| + return true; |
| +} |
| + |
| + |
| bool TypeArguments::IsBounded() const { |
| AbstractType& type = AbstractType::Handle(); |
| const intptr_t num_types = Length(); |
| @@ -3585,6 +3598,23 @@ |
| } |
| +RawAbstractTypeArguments* TypeArguments::CloneUnfinalized() const { |
| + if (IsFinalized()) { |
| + return raw(); |
| + } |
| + AbstractType& type = AbstractType::Handle(); |
| + const intptr_t num_types = Length(); |
| + const TypeArguments& clone = TypeArguments::Handle( |
| + TypeArguments::New(num_types)); |
| + for (intptr_t i = 0; i < num_types; i++) { |
| + type = TypeAt(i); |
| + type = type.CloneUnfinalized(); |
| + clone.SetTypeAt(i, type); |
| + } |
| + return clone.raw(); |
| +} |
| + |
| + |
| RawAbstractTypeArguments* TypeArguments::Canonicalize() const { |
| if (IsNull() || IsCanonical()) { |
| ASSERT(IsOld()); |
| @@ -10832,6 +10862,13 @@ |
| } |
| +RawAbstractType* AbstractType::CloneUnfinalized() const { |
| + // AbstractType is an abstract class. |
| + UNREACHABLE(); |
| + return NULL; |
| +} |
| + |
| + |
| RawAbstractType* AbstractType::Canonicalize() const { |
| // AbstractType is an abstract class. |
| UNREACHABLE(); |
| @@ -11361,6 +11398,20 @@ |
| } |
| +RawAbstractType* Type::CloneUnfinalized() const { |
| + ASSERT(IsResolved()); |
| + if (IsFinalized()) { |
| + return raw(); |
| + } |
| + ASSERT(!IsMalformed()); // Malformed types are finalized. |
| + ASSERT(!IsBeingFinalized()); // Cloning must occur prior to finalization. |
| + AbstractTypeArguments& type_args = AbstractTypeArguments::Handle(arguments()); |
| + type_args = type_args.CloneUnfinalized(); |
| + const Class& type_cls = Class::Handle(type_class()); |
| + return Type::New(type_cls, type_args, token_pos()); |
| +} |
| + |
| + |
| RawAbstractType* Type::Canonicalize() const { |
| ASSERT(IsFinalized()); |
| if (IsCanonical() || IsMalformed()) { |
| @@ -11650,6 +11701,19 @@ |
| } |
| +RawAbstractType* TypeParameter::CloneUnfinalized() const { |
| + if (IsFinalized()) { |
| + return raw(); |
| + } |
| + // No need to clone bound, as it is not part of the finalization state. |
| + return TypeParameter::New(Class::Handle(parameterized_class()), |
| + index(), |
| + String::Handle(name()), |
| + AbstractType::Handle(bound()), |
| + token_pos()); |
| +} |
| + |
| + |
| intptr_t TypeParameter::Hash() const { |
| ASSERT(IsFinalized()); |
| uword result = 0; |
| @@ -11829,6 +11893,21 @@ |
| } |
| +RawAbstractType* BoundedType::CloneUnfinalized() const { |
| + if (IsFinalized()) { |
| + return raw(); |
| + } |
| + AbstractType& bounded_type = AbstractType::Handle(type()); |
| + |
| + bounded_type = bounded_type.CloneUnfinalized(); |
| + // No need to clone bound or type parameter, as they are not part of the |
| + // finalization state of this bounded type. |
| + return BoundedType::New(bounded_type, |
| + AbstractType::Handle(bound()), |
| + TypeParameter::Handle(type_parameter())); |
| +} |
| + |
| + |
| intptr_t BoundedType::Hash() const { |
| uword result = 0; |
| result += AbstractType::Handle(type()).Hash(); |