| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/become.h" | 10 #include "vm/become.h" |
| (...skipping 16928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16939 clone.set_signature(fun_clone); | 16939 clone.set_signature(fun_clone); |
| 16940 } | 16940 } |
| 16941 clone.SetIsResolved(); | 16941 clone.SetIsResolved(); |
| 16942 return clone.raw(); | 16942 return clone.raw(); |
| 16943 } | 16943 } |
| 16944 | 16944 |
| 16945 | 16945 |
| 16946 RawAbstractType* Type::CloneUninstantiated(const Class& new_owner, | 16946 RawAbstractType* Type::CloneUninstantiated(const Class& new_owner, |
| 16947 TrailPtr trail) const { | 16947 TrailPtr trail) const { |
| 16948 ASSERT(IsFinalized()); | 16948 ASSERT(IsFinalized()); |
| 16949 ASSERT(IsCanonical()); |
| 16949 ASSERT(!IsMalformed()); | 16950 ASSERT(!IsMalformed()); |
| 16950 if (IsInstantiated()) { | 16951 if (IsInstantiated()) { |
| 16951 return raw(); | 16952 return raw(); |
| 16952 } | 16953 } |
| 16953 // We may recursively encounter a type already being cloned, because we clone | 16954 // We may recursively encounter a type already being cloned, because we clone |
| 16954 // the upper bounds of its uninstantiated type arguments in the same pass. | 16955 // the upper bounds of its uninstantiated type arguments in the same pass. |
| 16955 Zone* zone = Thread::Current()->zone(); | 16956 Zone* zone = Thread::Current()->zone(); |
| 16956 Type& clone = Type::Handle(zone); | 16957 Type& clone = Type::Handle(zone); |
| 16957 clone ^= OnlyBuddyInTrail(trail); | 16958 clone ^= OnlyBuddyInTrail(trail); |
| 16958 if (!clone.IsNull()) { | 16959 if (!clone.IsNull()) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17010 } | 17011 } |
| 17011 if (!type_args_cloned) { | 17012 if (!type_args_cloned) { |
| 17012 // Upper bounds of uninstantiated type arguments may form a cycle. | 17013 // Upper bounds of uninstantiated type arguments may form a cycle. |
| 17013 if (type_args.IsRecursive() || !type_args.IsInstantiated()) { | 17014 if (type_args.IsRecursive() || !type_args.IsInstantiated()) { |
| 17014 AddOnlyBuddyToTrail(&trail, clone); | 17015 AddOnlyBuddyToTrail(&trail, clone); |
| 17015 } | 17016 } |
| 17016 type_args = type_args.CloneUninstantiated(new_owner, trail); | 17017 type_args = type_args.CloneUninstantiated(new_owner, trail); |
| 17017 clone.set_arguments(type_args); | 17018 clone.set_arguments(type_args); |
| 17018 } | 17019 } |
| 17019 clone.SetIsFinalized(); | 17020 clone.SetIsFinalized(); |
| 17021 clone ^= clone.Canonicalize(); |
| 17020 return clone.raw(); | 17022 return clone.raw(); |
| 17021 } | 17023 } |
| 17022 | 17024 |
| 17023 | 17025 |
| 17024 RawAbstractType* Type::Canonicalize(TrailPtr trail) const { | 17026 RawAbstractType* Type::Canonicalize(TrailPtr trail) const { |
| 17025 ASSERT(IsFinalized()); | 17027 ASSERT(IsFinalized()); |
| 17026 if (IsCanonical() || IsMalformed()) { | 17028 if (IsCanonical() || IsMalformed()) { |
| 17027 ASSERT(IsMalformed() || TypeArguments::Handle(arguments()).IsOld()); | 17029 ASSERT(IsMalformed() || TypeArguments::Handle(arguments()).IsOld()); |
| 17028 return this->raw(); | 17030 return this->raw(); |
| 17029 } | 17031 } |
| (...skipping 5659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22689 return UserTag::null(); | 22691 return UserTag::null(); |
| 22690 } | 22692 } |
| 22691 | 22693 |
| 22692 | 22694 |
| 22693 const char* UserTag::ToCString() const { | 22695 const char* UserTag::ToCString() const { |
| 22694 const String& tag_label = String::Handle(label()); | 22696 const String& tag_label = String::Handle(label()); |
| 22695 return tag_label.ToCString(); | 22697 return tag_label.ToCString(); |
| 22696 } | 22698 } |
| 22697 | 22699 |
| 22698 } // namespace dart | 22700 } // namespace dart |
| OLD | NEW |