| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // The trailing . on the default constructor name is dropped: | 211 // The trailing . on the default constructor name is dropped: |
| 212 // | 212 // |
| 213 // List. -> List | 213 // List. -> List |
| 214 // | 214 // |
| 215 // And so forth: | 215 // And so forth: |
| 216 // | 216 // |
| 217 // get:foo@6328321 -> foo | 217 // get:foo@6328321 -> foo |
| 218 // _MyClass@6328321. -> _MyClass | 218 // _MyClass@6328321. -> _MyClass |
| 219 // _MyClass@6328321.named -> _MyClass.named | 219 // _MyClass@6328321.named -> _MyClass.named |
| 220 // | 220 // |
| 221 RawString* String::IdentifierPrettyName(const String& name) { | 221 RawString* String::ScrubName(const String& name) { |
| 222 Zone* zone = Thread::Current()->zone(); | 222 Zone* zone = Thread::Current()->zone(); |
| 223 if (name.Equals(Symbols::TopLevel())) { | 223 if (name.Equals(Symbols::TopLevel())) { |
| 224 // Name of invisible top-level class. | 224 // Name of invisible top-level class. |
| 225 return Symbols::Empty().raw(); | 225 return Symbols::Empty().raw(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 const char* cname = name.ToCString(); | 228 const char* cname = name.ToCString(); |
| 229 ASSERT(strlen(cname) == static_cast<size_t>(name.Length())); | 229 ASSERT(strlen(cname) == static_cast<size_t>(name.Length())); |
| 230 const intptr_t name_len = name.Length(); | 230 const intptr_t name_len = name.Length(); |
| 231 // First remove all private name mangling. | 231 // First remove all private name mangling. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 AppendSubString(zone, &unmangled_segments, equals, 0, equals_len); | 314 AppendSubString(zone, &unmangled_segments, equals, 0, equals_len); |
| 315 final_len += equals_len; | 315 final_len += equals_len; |
| 316 } | 316 } |
| 317 | 317 |
| 318 unmangled_name = MergeSubStrings(zone, unmangled_segments, final_len); | 318 unmangled_name = MergeSubStrings(zone, unmangled_segments, final_len); |
| 319 | 319 |
| 320 return Symbols::New(unmangled_name); | 320 return Symbols::New(unmangled_name); |
| 321 } | 321 } |
| 322 | 322 |
| 323 | 323 |
| 324 RawString* String::IdentifierPrettyNameRetainPrivate(const String& name) { | 324 RawString* String::ScrubNameRetainPrivate(const String& name) { |
| 325 intptr_t len = name.Length(); | 325 intptr_t len = name.Length(); |
| 326 intptr_t start = 0; | 326 intptr_t start = 0; |
| 327 intptr_t at_pos = -1; // Position of '@' in the name, if any. | 327 intptr_t at_pos = -1; // Position of '@' in the name, if any. |
| 328 bool is_setter = false; | 328 bool is_setter = false; |
| 329 | 329 |
| 330 for (intptr_t i = start; i < len; i++) { | 330 for (intptr_t i = start; i < len; i++) { |
| 331 if (name.CharAt(i) == ':') { | 331 if (name.CharAt(i) == ':') { |
| 332 ASSERT(start == 0); // Only one : is possible in getters or setters. | 332 ASSERT(start == 0); // Only one : is possible in getters or setters. |
| 333 if (name.CharAt(0) == 's') { | 333 if (name.CharAt(0) == 's') { |
| 334 is_setter = true; | 334 is_setter = true; |
| (...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 | 1912 |
| 1913 | 1913 |
| 1914 RawString* Class::Name() const { | 1914 RawString* Class::Name() const { |
| 1915 // TODO(turnidge): This assert fails for the fake kFreeListElement class. | 1915 // TODO(turnidge): This assert fails for the fake kFreeListElement class. |
| 1916 // Fix this. | 1916 // Fix this. |
| 1917 ASSERT(raw_ptr()->name_ != String::null()); | 1917 ASSERT(raw_ptr()->name_ != String::null()); |
| 1918 return raw_ptr()->name_; | 1918 return raw_ptr()->name_; |
| 1919 } | 1919 } |
| 1920 | 1920 |
| 1921 | 1921 |
| 1922 RawString* Class::PrettyName() const { | 1922 RawString* Class::ScrubbedName() const { |
| 1923 return GeneratePrettyName(); | 1923 return String::ScrubName(String::Handle(Name())); |
| 1924 } | 1924 } |
| 1925 | 1925 |
| 1926 | 1926 |
| 1927 RawString* Class::UserVisibleName() const { | 1927 RawString* Class::UserVisibleName() const { |
| 1928 #if defined(PRODUCT) | 1928 #if defined(PRODUCT) |
| 1929 return raw_ptr()->name_; | 1929 return GenerateUserVisibleName(); |
| 1930 #else // defined(PRODUCT) | 1930 #else // defined(PRODUCT) |
| 1931 ASSERT(raw_ptr()->user_name_ != String::null()); | 1931 ASSERT(raw_ptr()->user_name_ != String::null()); |
| 1932 return raw_ptr()->user_name_; | 1932 return raw_ptr()->user_name_; |
| 1933 #endif // defined(PRODUCT) | 1933 #endif // defined(PRODUCT) |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 | 1936 |
| 1937 bool Class::IsInFullSnapshot() const { | 1937 bool Class::IsInFullSnapshot() const { |
| 1938 NoSafepointScope no_safepoint; | 1938 NoSafepointScope no_safepoint; |
| 1939 return raw_ptr()->library_->ptr()->is_in_fullsnapshot_; | 1939 return raw_ptr()->library_->ptr()->is_in_fullsnapshot_; |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3156 intptr_t instance_size = ExternalTypedData::InstanceSize(); | 3156 intptr_t instance_size = ExternalTypedData::InstanceSize(); |
| 3157 Class& result = Class::Handle(New<ExternalTypedData>(class_id)); | 3157 Class& result = Class::Handle(New<ExternalTypedData>(class_id)); |
| 3158 result.set_instance_size(instance_size); | 3158 result.set_instance_size(instance_size); |
| 3159 result.set_next_field_offset(ExternalTypedData::NextFieldOffset()); | 3159 result.set_next_field_offset(ExternalTypedData::NextFieldOffset()); |
| 3160 result.set_is_prefinalized(); | 3160 result.set_is_prefinalized(); |
| 3161 return result.raw(); | 3161 return result.raw(); |
| 3162 } | 3162 } |
| 3163 | 3163 |
| 3164 | 3164 |
| 3165 void Class::set_name(const String& value) const { | 3165 void Class::set_name(const String& value) const { |
| 3166 ASSERT(raw_ptr()->name_ == String::null()); |
| 3166 ASSERT(value.IsSymbol()); | 3167 ASSERT(value.IsSymbol()); |
| 3167 StorePointer(&raw_ptr()->name_, value.raw()); | 3168 StorePointer(&raw_ptr()->name_, value.raw()); |
| 3168 NOT_IN_PRODUCT( | 3169 NOT_IN_PRODUCT( |
| 3169 if (raw_ptr()->user_name_ == String::null()) { | 3170 if (raw_ptr()->user_name_ == String::null()) { |
| 3170 // TODO(johnmccutchan): Eagerly set user name for VM isolate classes, | 3171 // TODO(johnmccutchan): Eagerly set user name for VM isolate classes, |
| 3171 // lazily set user name for the other classes. | 3172 // lazily set user name for the other classes. |
| 3172 // Generate and set user_name. | 3173 // Generate and set user_name. |
| 3173 const String& user_name = String::Handle(GenerateUserVisibleName()); | 3174 const String& user_name = String::Handle(GenerateUserVisibleName()); |
| 3174 set_user_name(user_name); | 3175 set_user_name(user_name); |
| 3175 } | 3176 } |
| 3176 ) | 3177 ) |
| 3177 } | 3178 } |
| 3178 | 3179 |
| 3179 | 3180 |
| 3180 NOT_IN_PRODUCT( | 3181 NOT_IN_PRODUCT( |
| 3181 void Class::set_user_name(const String& value) const { | 3182 void Class::set_user_name(const String& value) const { |
| 3182 StorePointer(&raw_ptr()->user_name_, value.raw()); | 3183 StorePointer(&raw_ptr()->user_name_, value.raw()); |
| 3183 } | 3184 } |
| 3184 ) | 3185 ) |
| 3185 | 3186 |
| 3186 | 3187 |
| 3187 RawString* Class::GeneratePrettyName() const { | |
| 3188 const String& name = String::Handle(Name()); | |
| 3189 return String::IdentifierPrettyName(name); | |
| 3190 } | |
| 3191 | |
| 3192 | |
| 3193 RawString* Class::GenerateUserVisibleName() const { | 3188 RawString* Class::GenerateUserVisibleName() const { |
| 3194 if (FLAG_show_internal_names) { | 3189 if (FLAG_show_internal_names) { |
| 3195 return Name(); | 3190 return Name(); |
| 3196 } | 3191 } |
| 3197 switch (id()) { | 3192 switch (id()) { |
| 3198 case kNullCid: | 3193 case kNullCid: |
| 3199 return Symbols::Null().raw(); | 3194 return Symbols::Null().raw(); |
| 3200 case kDynamicCid: | 3195 case kDynamicCid: |
| 3201 return Symbols::Dynamic().raw(); | 3196 return Symbols::Dynamic().raw(); |
| 3202 case kVoidCid: | 3197 case kVoidCid: |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3320 case kExternalTypedDataFloat64x2ArrayCid: | 3315 case kExternalTypedDataFloat64x2ArrayCid: |
| 3321 return Symbols::Float64x2List().raw(); | 3316 return Symbols::Float64x2List().raw(); |
| 3322 case kTypedDataFloat32ArrayCid: | 3317 case kTypedDataFloat32ArrayCid: |
| 3323 case kExternalTypedDataFloat32ArrayCid: | 3318 case kExternalTypedDataFloat32ArrayCid: |
| 3324 return Symbols::Float32List().raw(); | 3319 return Symbols::Float32List().raw(); |
| 3325 case kTypedDataFloat64ArrayCid: | 3320 case kTypedDataFloat64ArrayCid: |
| 3326 case kExternalTypedDataFloat64ArrayCid: | 3321 case kExternalTypedDataFloat64ArrayCid: |
| 3327 return Symbols::Float64List().raw(); | 3322 return Symbols::Float64List().raw(); |
| 3328 default: | 3323 default: |
| 3329 const String& name = String::Handle(Name()); | 3324 const String& name = String::Handle(Name()); |
| 3330 return String::IdentifierPrettyName(name); | 3325 return String::ScrubName(name); |
| 3331 } | 3326 } |
| 3332 UNREACHABLE(); | 3327 UNREACHABLE(); |
| 3333 } | 3328 } |
| 3334 | 3329 |
| 3335 | 3330 |
| 3336 void Class::set_script(const Script& value) const { | 3331 void Class::set_script(const Script& value) const { |
| 3337 StorePointer(&raw_ptr()->script_, value.raw()); | 3332 StorePointer(&raw_ptr()->script_, value.raw()); |
| 3338 } | 3333 } |
| 3339 | 3334 |
| 3340 | 3335 |
| (...skipping 3309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6650 ASSERT(obj.IsPatchClass()); | 6645 ASSERT(obj.IsPatchClass()); |
| 6651 return PatchClass::Cast(obj).script(); | 6646 return PatchClass::Cast(obj).script(); |
| 6652 } | 6647 } |
| 6653 | 6648 |
| 6654 | 6649 |
| 6655 bool Function::HasOptimizedCode() const { | 6650 bool Function::HasOptimizedCode() const { |
| 6656 return HasCode() && Code::Handle(CurrentCode()).is_optimized(); | 6651 return HasCode() && Code::Handle(CurrentCode()).is_optimized(); |
| 6657 } | 6652 } |
| 6658 | 6653 |
| 6659 | 6654 |
| 6660 RawString* Function::PrettyName() const { | |
| 6661 const String& str = String::Handle(name()); | |
| 6662 return String::IdentifierPrettyName(str); | |
| 6663 } | |
| 6664 | |
| 6665 | |
| 6666 const char* Function::QualifiedUserVisibleNameCString() const { | |
| 6667 const String& str = String::Handle(QualifiedUserVisibleName()); | |
| 6668 return str.ToCString(); | |
| 6669 } | |
| 6670 | |
| 6671 | |
| 6672 RawString* Function::UserVisibleName() const { | 6655 RawString* Function::UserVisibleName() const { |
| 6673 return PrettyName(); | 6656 if (FLAG_show_internal_names) { |
| 6674 } | 6657 return name(); |
| 6675 | |
| 6676 | |
| 6677 RawString* Function::QualifiedPrettyName() const { | |
| 6678 String& tmp = String::Handle(); | |
| 6679 const Class& cls = Class::Handle(Owner()); | |
| 6680 | |
| 6681 if (IsClosureFunction()) { | |
| 6682 if (IsLocalFunction() && !IsImplicitClosureFunction()) { | |
| 6683 const Function& parent = Function::Handle(parent_function()); | |
| 6684 tmp = parent.QualifiedPrettyName(); | |
| 6685 } else { | |
| 6686 return PrettyName(); | |
| 6687 } | |
| 6688 } else { | |
| 6689 if (cls.IsTopLevel()) { | |
| 6690 return PrettyName(); | |
| 6691 } else { | |
| 6692 tmp = cls.PrettyName(); | |
| 6693 } | |
| 6694 } | 6658 } |
| 6695 tmp = String::Concat(tmp, Symbols::Dot(), Heap::kOld); | 6659 return String::ScrubName(String::Handle(name())); |
| 6696 const String& suffix = String::Handle(PrettyName()); | |
| 6697 return String::Concat(tmp, suffix, Heap::kOld); | |
| 6698 } | 6660 } |
| 6699 | 6661 |
| 6700 | 6662 |
| 6701 RawString* Function::QualifiedUserVisibleName() const { | 6663 RawString* Function::QualifiedUserVisibleName() const { |
| 6702 String& tmp = String::Handle(); | 6664 String& result = String::Handle(UserVisibleName()); |
| 6703 const Class& cls = Class::Handle(Owner()); | |
| 6704 | |
| 6705 if (IsClosureFunction()) { | 6665 if (IsClosureFunction()) { |
| 6706 if (IsLocalFunction() && !IsImplicitClosureFunction()) { | 6666 Function& fun = Function::Handle(raw()); |
| 6707 const Function& parent = Function::Handle(parent_function()); | 6667 while (fun.IsLocalFunction() && !fun.IsImplicitClosureFunction()) { |
| 6708 tmp = parent.QualifiedUserVisibleName(); | 6668 fun = fun.parent_function(); |
| 6709 } else { | 6669 result = String::Concat(Symbols::Dot(), result, Heap::kOld); |
| 6710 return UserVisibleName(); | 6670 result = String::Concat( |
| 6711 } | 6671 String::Handle(fun.UserVisibleName()), result, Heap::kOld); |
| 6712 } else { | |
| 6713 if (cls.IsTopLevel()) { | |
| 6714 return UserVisibleName(); | |
| 6715 } else { | |
| 6716 tmp = cls.UserVisibleName(); | |
| 6717 } | 6672 } |
| 6718 } | 6673 } |
| 6719 tmp = String::Concat(tmp, Symbols::Dot()); | 6674 const Class& cls = Class::Handle(Owner()); |
| 6720 const String& suffix = String::Handle(UserVisibleName()); | 6675 if (!cls.IsTopLevel()) { |
| 6721 return String::Concat(tmp, suffix); | 6676 result = String::Concat(Symbols::Dot(), result, Heap::kOld); |
| 6677 result = String::Concat( |
| 6678 String::Handle(cls.UserVisibleName()), result, Heap::kOld); |
| 6679 } |
| 6680 return result.raw(); |
| 6722 } | 6681 } |
| 6723 | 6682 |
| 6724 | 6683 |
| 6725 RawString* Function::GetSource() const { | 6684 RawString* Function::GetSource() const { |
| 6726 if (IsImplicitConstructor() || IsSignatureFunction()) { | 6685 if (IsImplicitConstructor() || IsSignatureFunction()) { |
| 6727 // We may need to handle more cases when the restrictions on mixins are | 6686 // We may need to handle more cases when the restrictions on mixins are |
| 6728 // relaxed. In particular we might start associating some source with the | 6687 // relaxed. In particular we might start associating some source with the |
| 6729 // forwarding constructors when it becomes possible to specify a particular | 6688 // forwarding constructors when it becomes possible to specify a particular |
| 6730 // constructor from the mixin to use. | 6689 // constructor from the mixin to use. |
| 6731 return String::null(); | 6690 return String::null(); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7203 if (new_owner.NumTypeParameters() > 0) { | 7162 if (new_owner.NumTypeParameters() > 0) { |
| 7204 // Adjust the field type to refer to type parameters of the new owner. | 7163 // Adjust the field type to refer to type parameters of the new owner. |
| 7205 AbstractType& type = AbstractType::Handle(clone.type()); | 7164 AbstractType& type = AbstractType::Handle(clone.type()); |
| 7206 type ^= type.CloneUninstantiated(new_owner); | 7165 type ^= type.CloneUninstantiated(new_owner); |
| 7207 clone.SetFieldType(type); | 7166 clone.SetFieldType(type); |
| 7208 } | 7167 } |
| 7209 return clone.raw(); | 7168 return clone.raw(); |
| 7210 } | 7169 } |
| 7211 | 7170 |
| 7212 | 7171 |
| 7213 RawString* Field::PrettyName() const { | |
| 7214 const String& str = String::Handle(name()); | |
| 7215 return String::IdentifierPrettyName(str); | |
| 7216 } | |
| 7217 | |
| 7218 | |
| 7219 RawString* Field::UserVisibleName() const { | 7172 RawString* Field::UserVisibleName() const { |
| 7220 return PrettyName(); | 7173 if (FLAG_show_internal_names) { |
| 7174 return name(); |
| 7175 } |
| 7176 return String::ScrubName(String::Handle(name())); |
| 7221 } | 7177 } |
| 7222 | 7178 |
| 7223 | 7179 |
| 7224 intptr_t Field::guarded_list_length() const { | 7180 intptr_t Field::guarded_list_length() const { |
| 7225 return Smi::Value(raw_ptr()->guarded_list_length_); | 7181 return Smi::Value(raw_ptr()->guarded_list_length_); |
| 7226 } | 7182 } |
| 7227 | 7183 |
| 7228 | 7184 |
| 7229 void Field::set_guarded_list_length(intptr_t list_length) const { | 7185 void Field::set_guarded_list_length(intptr_t list_length) const { |
| 7230 ASSERT(Thread::Current()->IsMutatorThread()); | 7186 ASSERT(Thread::Current()->IsMutatorThread()); |
| (...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8967 return Symbols::FromConcatAll(pieces); | 8923 return Symbols::FromConcatAll(pieces); |
| 8968 } | 8924 } |
| 8969 | 8925 |
| 8970 | 8926 |
| 8971 static RawString* MakeFunctionMetaName(const Function& func) { | 8927 static RawString* MakeFunctionMetaName(const Function& func) { |
| 8972 const String& cname = | 8928 const String& cname = |
| 8973 String::Handle(MakeClassMetaName(Class::Handle(func.origin()))); | 8929 String::Handle(MakeClassMetaName(Class::Handle(func.origin()))); |
| 8974 GrowableHandlePtrArray<const String> pieces(Thread::Current()->zone(), 3); | 8930 GrowableHandlePtrArray<const String> pieces(Thread::Current()->zone(), 3); |
| 8975 pieces.Add(cname); | 8931 pieces.Add(cname); |
| 8976 pieces.Add(Symbols::At()); | 8932 pieces.Add(Symbols::At()); |
| 8977 pieces.Add(String::Handle(func.QualifiedPrettyName())); | 8933 pieces.Add(String::Handle(func.QualifiedUserVisibleName())); |
| 8978 return Symbols::FromConcatAll(pieces); | 8934 return Symbols::FromConcatAll(pieces); |
| 8979 } | 8935 } |
| 8980 | 8936 |
| 8981 | 8937 |
| 8982 static RawString* MakeTypeParameterMetaName(const TypeParameter& param) { | 8938 static RawString* MakeTypeParameterMetaName(const TypeParameter& param) { |
| 8983 const String& cname = String::Handle( | 8939 const String& cname = String::Handle( |
| 8984 MakeClassMetaName(Class::Handle(param.parameterized_class()))); | 8940 MakeClassMetaName(Class::Handle(param.parameterized_class()))); |
| 8985 GrowableHandlePtrArray<const String> pieces(Thread::Current()->zone(), 3); | 8941 GrowableHandlePtrArray<const String> pieces(Thread::Current()->zone(), 3); |
| 8986 pieces.Add(cname); | 8942 pieces.Add(cname); |
| 8987 pieces.Add(Symbols::At()); | 8943 pieces.Add(Symbols::At()); |
| (...skipping 4062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13050 ASSERT(!cls_name.IsNull()); | 13006 ASSERT(!cls_name.IsNull()); |
| 13051 return Symbols::FromConcat(Symbols::AllocationStubFor(), cls_name); | 13007 return Symbols::FromConcat(Symbols::AllocationStubFor(), cls_name); |
| 13052 } else { | 13008 } else { |
| 13053 ASSERT(obj.IsFunction()); | 13009 ASSERT(obj.IsFunction()); |
| 13054 // Dart function. | 13010 // Dart function. |
| 13055 return Function::Cast(obj).name(); | 13011 return Function::Cast(obj).name(); |
| 13056 } | 13012 } |
| 13057 } | 13013 } |
| 13058 | 13014 |
| 13059 | 13015 |
| 13060 RawString* Code::PrettyName() const { | 13016 RawString* Code::UserVisibleName() const { |
| 13061 const Object& obj = Object::Handle(owner()); | 13017 const Object& obj = Object::Handle(owner()); |
| 13062 if (obj.IsNull()) { | 13018 if (obj.IsFunction()) { |
| 13063 // Regular stub. | 13019 // Dart function. |
| 13064 const char* name = StubCode::NameOfStub(EntryPoint()); | 13020 return Function::Cast(obj).QualifiedUserVisibleName(); |
| 13065 ASSERT(name != NULL); | |
| 13066 const String& stub_name = String::Handle(String::New(name)); | |
| 13067 return String::Concat(Symbols::StubPrefix(), stub_name); | |
| 13068 } else if (obj.IsClass()) { | |
| 13069 // Allocation stub. | |
| 13070 const Class& cls = Class::Cast(obj); | |
| 13071 String& cls_name = String::Handle(cls.Name()); | |
| 13072 ASSERT(!cls_name.IsNull()); | |
| 13073 return String::Concat(Symbols::AllocationStubFor(), cls_name); | |
| 13074 } else { | 13021 } else { |
| 13075 ASSERT(obj.IsFunction()); | 13022 return Name(); |
| 13076 // Dart function. | |
| 13077 return Function::Cast(obj).QualifiedPrettyName(); | |
| 13078 } | 13023 } |
| 13079 } | 13024 } |
| 13080 | 13025 |
| 13081 | 13026 |
| 13082 bool Code::IsAllocationStubCode() const { | 13027 bool Code::IsAllocationStubCode() const { |
| 13083 const Object& obj = Object::Handle(owner()); | 13028 const Object& obj = Object::Handle(owner()); |
| 13084 return obj.IsClass(); | 13029 return obj.IsClass(); |
| 13085 } | 13030 } |
| 13086 | 13031 |
| 13087 | 13032 |
| (...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14784 (*trail)->Add(buddy); | 14729 (*trail)->Add(buddy); |
| 14785 return false; | 14730 return false; |
| 14786 } | 14731 } |
| 14787 | 14732 |
| 14788 | 14733 |
| 14789 RawString* AbstractType::BuildName(NameVisibility name_visibility) const { | 14734 RawString* AbstractType::BuildName(NameVisibility name_visibility) const { |
| 14790 Zone* zone = Thread::Current()->zone(); | 14735 Zone* zone = Thread::Current()->zone(); |
| 14791 if (IsBoundedType()) { | 14736 if (IsBoundedType()) { |
| 14792 const AbstractType& type = AbstractType::Handle( | 14737 const AbstractType& type = AbstractType::Handle( |
| 14793 BoundedType::Cast(*this).type()); | 14738 BoundedType::Cast(*this).type()); |
| 14794 if (name_visibility == kPrettyName) { | 14739 if (name_visibility == kUserVisibleName) { |
| 14795 return type.BuildName(kPrettyName); | |
| 14796 } else if (name_visibility == kUserVisibleName) { | |
| 14797 return type.BuildName(kUserVisibleName); | 14740 return type.BuildName(kUserVisibleName); |
| 14798 } | 14741 } |
| 14799 GrowableHandlePtrArray<const String> pieces(zone, 5); | 14742 GrowableHandlePtrArray<const String> pieces(zone, 5); |
| 14800 String& type_name = String::Handle(zone, type.BuildName(kInternalName)); | 14743 String& type_name = String::Handle(zone, type.BuildName(kInternalName)); |
| 14801 pieces.Add(type_name); | 14744 pieces.Add(type_name); |
| 14802 pieces.Add(Symbols::SpaceExtendsSpace()); | 14745 pieces.Add(Symbols::SpaceExtendsSpace()); |
| 14803 // Build the bound name without causing divergence. | 14746 // Build the bound name without causing divergence. |
| 14804 const AbstractType& bound = AbstractType::Handle( | 14747 const AbstractType& bound = AbstractType::Handle( |
| 14805 zone, BoundedType::Cast(*this).bound()); | 14748 zone, BoundedType::Cast(*this).bound()); |
| 14806 String& bound_name = String::Handle(zone); | 14749 String& bound_name = String::Handle(zone); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14856 if (IsResolved() || !cls.IsMixinApplication()) { | 14799 if (IsResolved() || !cls.IsMixinApplication()) { |
| 14857 // Do not print the full vector, but only the declared type parameters. | 14800 // Do not print the full vector, but only the declared type parameters. |
| 14858 num_type_params = cls.NumTypeParameters(); | 14801 num_type_params = cls.NumTypeParameters(); |
| 14859 } else { | 14802 } else { |
| 14860 // Do not print the type parameters of an unresolved mixin application, | 14803 // Do not print the type parameters of an unresolved mixin application, |
| 14861 // since it would prematurely trigger the application of the mixin type. | 14804 // since it would prematurely trigger the application of the mixin type. |
| 14862 num_type_params = 0; | 14805 num_type_params = 0; |
| 14863 } | 14806 } |
| 14864 if (name_visibility == kInternalName) { | 14807 if (name_visibility == kInternalName) { |
| 14865 class_name = cls.Name(); | 14808 class_name = cls.Name(); |
| 14866 } else if (name_visibility == kPrettyName) { | |
| 14867 class_name = cls.PrettyName(); | |
| 14868 } else { | 14809 } else { |
| 14869 ASSERT(name_visibility == kUserVisibleName); | 14810 ASSERT(name_visibility == kUserVisibleName); |
| 14870 // Map internal types to their corresponding public interfaces. | 14811 // Map internal types to their corresponding public interfaces. |
| 14871 class_name = cls.UserVisibleName(); | 14812 class_name = cls.UserVisibleName(); |
| 14872 } | 14813 } |
| 14873 if (num_type_params > num_args) { | 14814 if (num_type_params > num_args) { |
| 14874 first_type_param_index = 0; | 14815 first_type_param_index = 0; |
| 14875 if (!IsFinalized() || IsBeingFinalized() || IsMalformed()) { | 14816 if (!IsFinalized() || IsBeingFinalized() || IsMalformed()) { |
| 14876 // Most probably a malformed type. Do not fill up with "dynamic", | 14817 // Most probably a malformed type. Do not fill up with "dynamic", |
| 14877 // but use actual vector. | 14818 // but use actual vector. |
| (...skipping 6595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21473 return UserTag::null(); | 21414 return UserTag::null(); |
| 21474 } | 21415 } |
| 21475 | 21416 |
| 21476 | 21417 |
| 21477 const char* UserTag::ToCString() const { | 21418 const char* UserTag::ToCString() const { |
| 21478 const String& tag_label = String::Handle(label()); | 21419 const String& tag_label = String::Handle(label()); |
| 21479 return tag_label.ToCString(); | 21420 return tag_label.ToCString(); |
| 21480 } | 21421 } |
| 21481 | 21422 |
| 21482 } // namespace dart | 21423 } // namespace dart |
| OLD | NEW |