Chromium Code Reviews| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 DEFINE_FLAG(bool, trace_field_guards, false, "Trace changes in field's cids."); | 68 DEFINE_FLAG(bool, trace_field_guards, false, "Trace changes in field's cids."); |
| 69 | 69 |
| 70 DECLARE_FLAG(charp, coverage_dir); | 70 DECLARE_FLAG(charp, coverage_dir); |
| 71 DECLARE_FLAG(bool, load_deferred_eagerly); | 71 DECLARE_FLAG(bool, load_deferred_eagerly); |
| 72 DECLARE_FLAG(bool, show_invisible_frames); | 72 DECLARE_FLAG(bool, show_invisible_frames); |
| 73 DECLARE_FLAG(bool, trace_compiler); | 73 DECLARE_FLAG(bool, trace_compiler); |
| 74 DECLARE_FLAG(bool, trace_deoptimization); | 74 DECLARE_FLAG(bool, trace_deoptimization); |
| 75 DECLARE_FLAG(bool, trace_deoptimization_verbose); | 75 DECLARE_FLAG(bool, trace_deoptimization_verbose); |
| 76 DECLARE_FLAG(bool, write_protect_code); | 76 DECLARE_FLAG(bool, write_protect_code); |
| 77 | 77 |
| 78 | |
| 79 static const char* kGetterPrefix = "get:"; | 78 static const char* kGetterPrefix = "get:"; |
| 80 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); | 79 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); |
| 81 static const char* kSetterPrefix = "set:"; | 80 static const char* kSetterPrefix = "set:"; |
| 82 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); | 81 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); |
| 83 | 82 |
| 84 cpp_vtable Object::handle_vtable_ = 0; | 83 cpp_vtable Object::handle_vtable_ = 0; |
| 85 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; | 84 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; |
| 86 cpp_vtable Smi::handle_vtable_ = 0; | 85 cpp_vtable Smi::handle_vtable_ = 0; |
| 87 | 86 |
| 88 // These are initialized to a value that will force a illegal memory access if | 87 // These are initialized to a value that will force a illegal memory access if |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 // First remove all private name mangling. | 196 // First remove all private name mangling. |
| 198 String& unmangled_name = String::Handle(Symbols::Empty().raw()); | 197 String& unmangled_name = String::Handle(Symbols::Empty().raw()); |
| 199 String& segment = String::Handle(); | 198 String& segment = String::Handle(); |
| 200 intptr_t start_pos = 0; | 199 intptr_t start_pos = 0; |
| 201 for (intptr_t i = 0; i < name.Length(); i++) { | 200 for (intptr_t i = 0; i < name.Length(); i++) { |
| 202 if (name.CharAt(i) == '@' && | 201 if (name.CharAt(i) == '@' && |
| 203 (i+1) < name.Length() && | 202 (i+1) < name.Length() && |
| 204 (name.CharAt(i+1) >= '0') && | 203 (name.CharAt(i+1) >= '0') && |
| 205 (name.CharAt(i+1) <= '9')) { | 204 (name.CharAt(i+1) <= '9')) { |
| 206 // Append the current segment to the unmangled name. | 205 // Append the current segment to the unmangled name. |
| 207 segment = String::SubString(name, start_pos, (i - start_pos)); | 206 segment = String::SubString(name, start_pos, (i - start_pos), Heap::kOld); |
|
hausner
2015/09/05 01:22:10
We are starting to litter the old heap space with
srdjan
2015/09/06 05:24:10
I assumed this function was used only by the disas
| |
| 208 unmangled_name = String::Concat(unmangled_name, segment); | 207 unmangled_name = String::Concat(unmangled_name, segment, Heap::kOld); |
| 209 | 208 |
| 210 // Advance until past the name mangling. The private keys are only | 209 // Advance until past the name mangling. The private keys are only |
| 211 // numbers so we skip until the first non-number. | 210 // numbers so we skip until the first non-number. |
| 212 i++; // Skip the '@'. | 211 i++; // Skip the '@'. |
| 213 while ((i < name.Length()) && | 212 while ((i < name.Length()) && |
| 214 (name.CharAt(i) >= '0') && | 213 (name.CharAt(i) >= '0') && |
| 215 (name.CharAt(i) <= '9')) { | 214 (name.CharAt(i) <= '9')) { |
| 216 i++; | 215 i++; |
| 217 } | 216 } |
| 218 start_pos = i; | 217 start_pos = i; |
| 219 i--; // Account for for-loop increment. | 218 i--; // Account for for-loop increment. |
| 220 } | 219 } |
| 221 } | 220 } |
| 222 if (start_pos == 0) { | 221 if (start_pos == 0) { |
| 223 // No name unmangling needed, reuse the name that was passed in. | 222 // No name unmangling needed, reuse the name that was passed in. |
| 224 unmangled_name = name.raw(); | 223 unmangled_name = name.raw(); |
| 225 } else if (name.Length() != start_pos) { | 224 } else if (name.Length() != start_pos) { |
| 226 // Append the last segment. | 225 // Append the last segment. |
| 227 segment = String::SubString(name, start_pos, (name.Length() - start_pos)); | 226 segment = String::SubString( |
| 228 unmangled_name = String::Concat(unmangled_name, segment); | 227 name, start_pos, (name.Length() - start_pos), Heap::kOld); |
| 228 unmangled_name = String::Concat(unmangled_name, segment, Heap::kOld); | |
| 229 } | 229 } |
| 230 | 230 |
| 231 intptr_t len = unmangled_name.Length(); | 231 intptr_t len = unmangled_name.Length(); |
| 232 intptr_t start = 0; | 232 intptr_t start = 0; |
| 233 intptr_t dot_pos = -1; // Position of '.' in the name, if any. | 233 intptr_t dot_pos = -1; // Position of '.' in the name, if any. |
| 234 bool is_setter = false; | 234 bool is_setter = false; |
| 235 for (intptr_t i = start; i < len; i++) { | 235 for (intptr_t i = start; i < len; i++) { |
| 236 if (unmangled_name.CharAt(i) == ':') { | 236 if (unmangled_name.CharAt(i) == ':') { |
| 237 if (start != 0) { | 237 if (start != 0) { |
| 238 // Reset and break. | 238 // Reset and break. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 259 | 259 |
| 260 if ((start == 0) && (dot_pos == -1)) { | 260 if ((start == 0) && (dot_pos == -1)) { |
| 261 // This unmangled_name is fine as it is. | 261 // This unmangled_name is fine as it is. |
| 262 return unmangled_name.raw(); | 262 return unmangled_name.raw(); |
| 263 } | 263 } |
| 264 | 264 |
| 265 // Drop the trailing dot if needed. | 265 // Drop the trailing dot if needed. |
| 266 intptr_t end = ((dot_pos + 1) == len) ? dot_pos : len; | 266 intptr_t end = ((dot_pos + 1) == len) ? dot_pos : len; |
| 267 | 267 |
| 268 const String& result = | 268 const String& result = |
| 269 String::Handle(String::SubString(unmangled_name, start, (end - start))); | 269 String::Handle(String::SubString( |
| 270 unmangled_name, start, (end - start), Heap::kOld)); | |
| 270 | 271 |
| 271 if (is_setter) { | 272 if (is_setter) { |
| 272 // Setters need to end with '='. | 273 // Setters need to end with '='. |
| 273 return String::Concat(result, Symbols::Equals()); | 274 return String::Concat(result, Symbols::Equals(), Heap::kOld); |
| 274 } | 275 } |
| 275 | 276 |
| 276 return result.raw(); | 277 return result.raw(); |
| 277 } | 278 } |
| 278 | 279 |
| 279 | 280 |
| 280 RawString* String::IdentifierPrettyNameRetainPrivate(const String& name) { | 281 RawString* String::IdentifierPrettyNameRetainPrivate(const String& name) { |
| 281 intptr_t len = name.Length(); | 282 intptr_t len = name.Length(); |
| 282 intptr_t start = 0; | 283 intptr_t start = 0; |
| 283 intptr_t at_pos = -1; // Position of '@' in the name, if any. | 284 intptr_t at_pos = -1; // Position of '@' in the name, if any. |
| (...skipping 3295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3579 if (direct_subclasses.IsNull()) { | 3580 if (direct_subclasses.IsNull()) { |
| 3580 direct_subclasses = GrowableObjectArray::New(4, Heap::kOld); | 3581 direct_subclasses = GrowableObjectArray::New(4, Heap::kOld); |
| 3581 StorePointer(&raw_ptr()->direct_subclasses_, direct_subclasses.raw()); | 3582 StorePointer(&raw_ptr()->direct_subclasses_, direct_subclasses.raw()); |
| 3582 } | 3583 } |
| 3583 #if defined(DEBUG) | 3584 #if defined(DEBUG) |
| 3584 // Verify that the same class is not added twice. | 3585 // Verify that the same class is not added twice. |
| 3585 for (intptr_t i = 0; i < direct_subclasses.Length(); i++) { | 3586 for (intptr_t i = 0; i < direct_subclasses.Length(); i++) { |
| 3586 ASSERT(direct_subclasses.At(i) != subclass.raw()); | 3587 ASSERT(direct_subclasses.At(i) != subclass.raw()); |
| 3587 } | 3588 } |
| 3588 #endif | 3589 #endif |
| 3589 direct_subclasses.Add(subclass); | 3590 direct_subclasses.Add(subclass, Heap::kOld); |
| 3590 } | 3591 } |
| 3591 | 3592 |
| 3592 | 3593 |
| 3593 RawArray* Class::constants() const { | 3594 RawArray* Class::constants() const { |
| 3594 return raw_ptr()->constants_; | 3595 return raw_ptr()->constants_; |
| 3595 } | 3596 } |
| 3596 | 3597 |
| 3597 void Class::set_constants(const Array& value) const { | 3598 void Class::set_constants(const Array& value) const { |
| 3598 ASSERT(!value.IsNull()); | 3599 ASSERT(!value.IsNull()); |
| 3599 StorePointer(&raw_ptr()->constants_, value.raw()); | 3600 StorePointer(&raw_ptr()->constants_, value.raw()); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3728 // If test_kind == kIsMoreSpecificThan, checks if S is more specific than T. | 3729 // If test_kind == kIsMoreSpecificThan, checks if S is more specific than T. |
| 3729 // Type S is specified by this class parameterized with 'type_arguments', and | 3730 // Type S is specified by this class parameterized with 'type_arguments', and |
| 3730 // type T by class 'other' parameterized with 'other_type_arguments'. | 3731 // type T by class 'other' parameterized with 'other_type_arguments'. |
| 3731 // This class and class 'other' do not need to be finalized, however, they must | 3732 // This class and class 'other' do not need to be finalized, however, they must |
| 3732 // be resolved as well as their interfaces. | 3733 // be resolved as well as their interfaces. |
| 3733 bool Class::TypeTestNonRecursive(const Class& cls, | 3734 bool Class::TypeTestNonRecursive(const Class& cls, |
| 3734 Class::TypeTestKind test_kind, | 3735 Class::TypeTestKind test_kind, |
| 3735 const TypeArguments& type_arguments, | 3736 const TypeArguments& type_arguments, |
| 3736 const Class& other, | 3737 const Class& other, |
| 3737 const TypeArguments& other_type_arguments, | 3738 const TypeArguments& other_type_arguments, |
| 3738 Error* bound_error) { | 3739 Error* bound_error, |
| 3740 Heap::Space space) { | |
| 3739 // Use the thsi object as if it was the receiver of this method, but instead | 3741 // Use the thsi object as if it was the receiver of this method, but instead |
| 3740 // of recursing reset it to the super class and loop. | 3742 // of recursing reset it to the super class and loop. |
| 3741 Isolate* isolate = Isolate::Current(); | 3743 Isolate* isolate = Isolate::Current(); |
| 3742 Class& thsi = Class::Handle(isolate, cls.raw()); | 3744 Class& thsi = Class::Handle(isolate, cls.raw()); |
| 3743 while (true) { | 3745 while (true) { |
| 3744 ASSERT(!thsi.IsVoidClass()); | 3746 ASSERT(!thsi.IsVoidClass()); |
| 3745 // Check for DynamicType. | 3747 // Check for DynamicType. |
| 3746 // Each occurrence of DynamicType in type T is interpreted as the dynamic | 3748 // Each occurrence of DynamicType in type T is interpreted as the dynamic |
| 3747 // type, a supertype of all types. | 3749 // type, a supertype of all types. |
| 3748 if (other.IsDynamicClass()) { | 3750 if (other.IsDynamicClass()) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3785 type_arguments.IsRaw(from_index, num_type_params)) { | 3787 type_arguments.IsRaw(from_index, num_type_params)) { |
| 3786 // Other type can't be more specific than this one because for that | 3788 // Other type can't be more specific than this one because for that |
| 3787 // it would have to have all dynamic type arguments which is checked | 3789 // it would have to have all dynamic type arguments which is checked |
| 3788 // above. | 3790 // above. |
| 3789 return test_kind == Class::kIsSubtypeOf; | 3791 return test_kind == Class::kIsSubtypeOf; |
| 3790 } | 3792 } |
| 3791 return type_arguments.TypeTest(test_kind, | 3793 return type_arguments.TypeTest(test_kind, |
| 3792 other_type_arguments, | 3794 other_type_arguments, |
| 3793 from_index, | 3795 from_index, |
| 3794 num_type_params, | 3796 num_type_params, |
| 3795 bound_error); | 3797 bound_error, |
| 3798 space); | |
| 3796 } | 3799 } |
| 3797 const bool other_is_function_class = other.IsFunctionClass(); | 3800 const bool other_is_function_class = other.IsFunctionClass(); |
| 3798 if (other.IsSignatureClass() || other_is_function_class) { | 3801 if (other.IsSignatureClass() || other_is_function_class) { |
| 3799 const Function& other_fun = Function::Handle(isolate, | 3802 const Function& other_fun = Function::Handle(isolate, |
| 3800 other.signature_function()); | 3803 other.signature_function()); |
| 3801 if (thsi.IsSignatureClass()) { | 3804 if (thsi.IsSignatureClass()) { |
| 3802 if (other_is_function_class) { | 3805 if (other_is_function_class) { |
| 3803 return true; | 3806 return true; |
| 3804 } | 3807 } |
| 3805 // Check for two function types. | 3808 // Check for two function types. |
| 3806 const Function& fun = | 3809 const Function& fun = |
| 3807 Function::Handle(isolate, thsi.signature_function()); | 3810 Function::Handle(isolate, thsi.signature_function()); |
| 3808 return fun.TypeTest(test_kind, | 3811 return fun.TypeTest(test_kind, |
| 3809 type_arguments, | 3812 type_arguments, |
| 3810 other_fun, | 3813 other_fun, |
| 3811 other_type_arguments, | 3814 other_type_arguments, |
| 3812 bound_error); | 3815 bound_error, |
| 3816 space); | |
| 3813 } | 3817 } |
| 3814 // Check if type S has a call() method of function type T. | 3818 // Check if type S has a call() method of function type T. |
| 3815 Function& function = | 3819 Function& function = |
| 3816 Function::Handle(isolate, | 3820 Function::Handle(isolate, |
| 3817 thsi.LookupDynamicFunction(Symbols::Call())); | 3821 thsi.LookupDynamicFunction(Symbols::Call())); |
| 3818 if (function.IsNull()) { | 3822 if (function.IsNull()) { |
| 3819 // Walk up the super_class chain. | 3823 // Walk up the super_class chain. |
| 3820 Class& cls = Class::Handle(isolate, thsi.SuperClass()); | 3824 Class& cls = Class::Handle(isolate, thsi.SuperClass()); |
| 3821 while (!cls.IsNull() && function.IsNull()) { | 3825 while (!cls.IsNull() && function.IsNull()) { |
| 3822 function = cls.LookupDynamicFunction(Symbols::Call()); | 3826 function = cls.LookupDynamicFunction(Symbols::Call()); |
| 3823 cls = cls.SuperClass(); | 3827 cls = cls.SuperClass(); |
| 3824 } | 3828 } |
| 3825 } | 3829 } |
| 3826 if (!function.IsNull()) { | 3830 if (!function.IsNull()) { |
| 3827 if (other_is_function_class || | 3831 if (other_is_function_class || |
| 3828 function.TypeTest(test_kind, | 3832 function.TypeTest(test_kind, |
| 3829 type_arguments, | 3833 type_arguments, |
| 3830 other_fun, | 3834 other_fun, |
| 3831 other_type_arguments, | 3835 other_type_arguments, |
| 3832 bound_error)) { | 3836 bound_error, |
| 3837 space)) { | |
| 3833 return true; | 3838 return true; |
| 3834 } | 3839 } |
| 3835 } | 3840 } |
| 3836 } | 3841 } |
| 3837 // Check for 'direct super type' specified in the implements clause | 3842 // Check for 'direct super type' specified in the implements clause |
| 3838 // and check for transitivity at the same time. | 3843 // and check for transitivity at the same time. |
| 3839 Array& interfaces = Array::Handle(isolate, thsi.interfaces()); | 3844 Array& interfaces = Array::Handle(isolate, thsi.interfaces()); |
| 3840 AbstractType& interface = AbstractType::Handle(isolate); | 3845 AbstractType& interface = AbstractType::Handle(isolate); |
| 3841 Class& interface_class = Class::Handle(isolate); | 3846 Class& interface_class = Class::Handle(isolate); |
| 3842 TypeArguments& interface_args = TypeArguments::Handle(isolate); | 3847 TypeArguments& interface_args = TypeArguments::Handle(isolate); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 3862 if (!interface_args.IsNull() && !interface_args.IsInstantiated()) { | 3867 if (!interface_args.IsNull() && !interface_args.IsInstantiated()) { |
| 3863 // This type class implements an interface that is parameterized with | 3868 // This type class implements an interface that is parameterized with |
| 3864 // generic type(s), e.g. it implements List<T>. | 3869 // generic type(s), e.g. it implements List<T>. |
| 3865 // The uninstantiated type T must be instantiated using the type | 3870 // The uninstantiated type T must be instantiated using the type |
| 3866 // parameters of this type before performing the type test. | 3871 // parameters of this type before performing the type test. |
| 3867 // The type arguments of this type that are referred to by the type | 3872 // The type arguments of this type that are referred to by the type |
| 3868 // parameters of the interface are at the end of the type vector, | 3873 // parameters of the interface are at the end of the type vector, |
| 3869 // after the type arguments of the super type of this type. | 3874 // after the type arguments of the super type of this type. |
| 3870 // The index of the type parameters is adjusted upon finalization. | 3875 // The index of the type parameters is adjusted upon finalization. |
| 3871 error = Error::null(); | 3876 error = Error::null(); |
| 3872 interface_args = interface_args.InstantiateFrom(type_arguments, &error); | 3877 interface_args = |
| 3878 interface_args.InstantiateFrom(type_arguments, &error, NULL, space); | |
| 3873 if (!error.IsNull()) { | 3879 if (!error.IsNull()) { |
| 3874 // Return the first bound error to the caller if it requests it. | 3880 // Return the first bound error to the caller if it requests it. |
| 3875 if ((bound_error != NULL) && bound_error->IsNull()) { | 3881 if ((bound_error != NULL) && bound_error->IsNull()) { |
| 3876 *bound_error = error.raw(); | 3882 *bound_error = error.raw(); |
| 3877 } | 3883 } |
| 3878 continue; // Another interface may work better. | 3884 continue; // Another interface may work better. |
| 3879 } | 3885 } |
| 3880 } | 3886 } |
| 3881 if (interface_class.TypeTest(test_kind, | 3887 if (interface_class.TypeTest(test_kind, |
| 3882 interface_args, | 3888 interface_args, |
| 3883 other, | 3889 other, |
| 3884 other_type_arguments, | 3890 other_type_arguments, |
| 3885 bound_error)) { | 3891 bound_error, |
| 3892 space)) { | |
| 3886 return true; | 3893 return true; |
| 3887 } | 3894 } |
| 3888 } | 3895 } |
| 3889 // "Recurse" up the class hierarchy until we have reached the top. | 3896 // "Recurse" up the class hierarchy until we have reached the top. |
| 3890 thsi = thsi.SuperClass(); | 3897 thsi = thsi.SuperClass(); |
| 3891 if (thsi.IsNull()) { | 3898 if (thsi.IsNull()) { |
| 3892 return false; | 3899 return false; |
| 3893 } | 3900 } |
| 3894 } | 3901 } |
| 3895 UNREACHABLE(); | 3902 UNREACHABLE(); |
| 3896 return false; | 3903 return false; |
| 3897 } | 3904 } |
| 3898 | 3905 |
| 3899 | 3906 |
| 3900 // If test_kind == kIsSubtypeOf, checks if type S is a subtype of type T. | 3907 // If test_kind == kIsSubtypeOf, checks if type S is a subtype of type T. |
| 3901 // If test_kind == kIsMoreSpecificThan, checks if S is more specific than T. | 3908 // If test_kind == kIsMoreSpecificThan, checks if S is more specific than T. |
| 3902 // Type S is specified by this class parameterized with 'type_arguments', and | 3909 // Type S is specified by this class parameterized with 'type_arguments', and |
| 3903 // type T by class 'other' parameterized with 'other_type_arguments'. | 3910 // type T by class 'other' parameterized with 'other_type_arguments'. |
| 3904 // This class and class 'other' do not need to be finalized, however, they must | 3911 // This class and class 'other' do not need to be finalized, however, they must |
| 3905 // be resolved as well as their interfaces. | 3912 // be resolved as well as their interfaces. |
| 3906 bool Class::TypeTest(TypeTestKind test_kind, | 3913 bool Class::TypeTest(TypeTestKind test_kind, |
| 3907 const TypeArguments& type_arguments, | 3914 const TypeArguments& type_arguments, |
| 3908 const Class& other, | 3915 const Class& other, |
| 3909 const TypeArguments& other_type_arguments, | 3916 const TypeArguments& other_type_arguments, |
| 3910 Error* bound_error) const { | 3917 Error* bound_error, |
| 3918 Heap::Space space) const { | |
| 3911 return TypeTestNonRecursive(*this, | 3919 return TypeTestNonRecursive(*this, |
| 3912 test_kind, | 3920 test_kind, |
| 3913 type_arguments, | 3921 type_arguments, |
| 3914 other, | 3922 other, |
| 3915 other_type_arguments, | 3923 other_type_arguments, |
| 3916 bound_error); | 3924 bound_error, |
| 3925 space); | |
| 3917 } | 3926 } |
| 3918 | 3927 |
| 3919 | 3928 |
| 3920 bool Class::IsTopLevel() const { | 3929 bool Class::IsTopLevel() const { |
| 3921 return Name() == Symbols::TopLevel().raw(); | 3930 return Name() == Symbols::TopLevel().raw(); |
| 3922 } | 3931 } |
| 3923 | 3932 |
| 3924 | 3933 |
| 3925 bool Class::IsPrivate() const { | 3934 bool Class::IsPrivate() const { |
| 3926 return Library::IsPrivate(String::Handle(Name())); | 3935 return Library::IsPrivate(String::Handle(Name())); |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4544 } | 4553 } |
| 4545 } | 4554 } |
| 4546 return true; | 4555 return true; |
| 4547 } | 4556 } |
| 4548 | 4557 |
| 4549 | 4558 |
| 4550 bool TypeArguments::TypeTest(TypeTestKind test_kind, | 4559 bool TypeArguments::TypeTest(TypeTestKind test_kind, |
| 4551 const TypeArguments& other, | 4560 const TypeArguments& other, |
| 4552 intptr_t from_index, | 4561 intptr_t from_index, |
| 4553 intptr_t len, | 4562 intptr_t len, |
| 4554 Error* bound_error) const { | 4563 Error* bound_error, |
| 4564 Heap::Space space) const { | |
| 4555 ASSERT(Length() >= (from_index + len)); | 4565 ASSERT(Length() >= (from_index + len)); |
| 4556 ASSERT(!other.IsNull()); | 4566 ASSERT(!other.IsNull()); |
| 4557 ASSERT(other.Length() >= (from_index + len)); | 4567 ASSERT(other.Length() >= (from_index + len)); |
| 4558 AbstractType& type = AbstractType::Handle(); | 4568 AbstractType& type = AbstractType::Handle(); |
| 4559 AbstractType& other_type = AbstractType::Handle(); | 4569 AbstractType& other_type = AbstractType::Handle(); |
| 4560 for (intptr_t i = 0; i < len; i++) { | 4570 for (intptr_t i = 0; i < len; i++) { |
| 4561 type = TypeAt(from_index + i); | 4571 type = TypeAt(from_index + i); |
| 4562 ASSERT(!type.IsNull()); | 4572 ASSERT(!type.IsNull()); |
| 4563 other_type = other.TypeAt(from_index + i); | 4573 other_type = other.TypeAt(from_index + i); |
| 4564 ASSERT(!other_type.IsNull()); | 4574 ASSERT(!other_type.IsNull()); |
| 4565 if (!type.TypeTest(test_kind, other_type, bound_error)) { | 4575 if (!type.TypeTest(test_kind, other_type, bound_error, space)) { |
| 4566 return false; | 4576 return false; |
| 4567 } | 4577 } |
| 4568 } | 4578 } |
| 4569 return true; | 4579 return true; |
| 4570 } | 4580 } |
| 4571 | 4581 |
| 4572 | 4582 |
| 4573 void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const { | 4583 void TypeArguments::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 4574 JSONObject jsobj(stream); | 4584 JSONObject jsobj(stream); |
| 4575 // The index in the canonical_type_arguments table cannot be used as part of | 4585 // The index in the canonical_type_arguments table cannot be used as part of |
| (...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6040 } | 6050 } |
| 6041 | 6051 |
| 6042 | 6052 |
| 6043 bool Function::HasCompatibleParametersWith(const Function& other, | 6053 bool Function::HasCompatibleParametersWith(const Function& other, |
| 6044 Error* bound_error) const { | 6054 Error* bound_error) const { |
| 6045 ASSERT(Isolate::Current()->flags().error_on_bad_override()); | 6055 ASSERT(Isolate::Current()->flags().error_on_bad_override()); |
| 6046 ASSERT((bound_error != NULL) && bound_error->IsNull()); | 6056 ASSERT((bound_error != NULL) && bound_error->IsNull()); |
| 6047 // Check that this function's signature type is a subtype of the other | 6057 // Check that this function's signature type is a subtype of the other |
| 6048 // function's signature type. | 6058 // function's signature type. |
| 6049 if (!TypeTest(kIsSubtypeOf, Object::null_type_arguments(), | 6059 if (!TypeTest(kIsSubtypeOf, Object::null_type_arguments(), |
| 6050 other, Object::null_type_arguments(), bound_error)) { | 6060 other, Object::null_type_arguments(), bound_error, |
| 6061 Heap::kOld)) { | |
| 6051 // For more informative error reporting, use the location of the other | 6062 // For more informative error reporting, use the location of the other |
| 6052 // function here, since the caller will use the location of this function. | 6063 // function here, since the caller will use the location of this function. |
| 6053 *bound_error = LanguageError::NewFormatted( | 6064 *bound_error = LanguageError::NewFormatted( |
| 6054 *bound_error, // A bound error if non null. | 6065 *bound_error, // A bound error if non null. |
| 6055 Script::Handle(other.script()), | 6066 Script::Handle(other.script()), |
| 6056 other.token_pos(), | 6067 other.token_pos(), |
| 6057 Report::kError, | 6068 Report::kError, |
| 6058 Heap::kNew, | 6069 Heap::kNew, |
| 6059 "signature type '%s' of function '%s' is not a subtype of signature " | 6070 "signature type '%s' of function '%s' is not a subtype of signature " |
| 6060 "type '%s' of function '%s'", | 6071 "type '%s' of function '%s'", |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 6082 // parameter of the other function. | 6093 // parameter of the other function. |
| 6083 // Note that we do not apply contravariance of parameter types, but covariance | 6094 // Note that we do not apply contravariance of parameter types, but covariance |
| 6084 // of both parameter types and result type. | 6095 // of both parameter types and result type. |
| 6085 bool Function::TestParameterType( | 6096 bool Function::TestParameterType( |
| 6086 TypeTestKind test_kind, | 6097 TypeTestKind test_kind, |
| 6087 intptr_t parameter_position, | 6098 intptr_t parameter_position, |
| 6088 intptr_t other_parameter_position, | 6099 intptr_t other_parameter_position, |
| 6089 const TypeArguments& type_arguments, | 6100 const TypeArguments& type_arguments, |
| 6090 const Function& other, | 6101 const Function& other, |
| 6091 const TypeArguments& other_type_arguments, | 6102 const TypeArguments& other_type_arguments, |
| 6092 Error* bound_error) const { | 6103 Error* bound_error, |
| 6104 Heap::Space space) const { | |
| 6093 AbstractType& other_param_type = | 6105 AbstractType& other_param_type = |
| 6094 AbstractType::Handle(other.ParameterTypeAt(other_parameter_position)); | 6106 AbstractType::Handle(other.ParameterTypeAt(other_parameter_position)); |
| 6095 if (!other_param_type.IsInstantiated()) { | 6107 if (!other_param_type.IsInstantiated()) { |
| 6096 other_param_type = other_param_type.InstantiateFrom(other_type_arguments, | 6108 other_param_type = other_param_type.InstantiateFrom(other_type_arguments, |
| 6097 bound_error); | 6109 bound_error, |
| 6110 NULL, // trail | |
| 6111 space); | |
| 6098 ASSERT((bound_error == NULL) || bound_error->IsNull()); | 6112 ASSERT((bound_error == NULL) || bound_error->IsNull()); |
| 6099 } | 6113 } |
| 6100 if (other_param_type.IsDynamicType()) { | 6114 if (other_param_type.IsDynamicType()) { |
| 6101 return true; | 6115 return true; |
| 6102 } | 6116 } |
| 6103 AbstractType& param_type = | 6117 AbstractType& param_type = |
| 6104 AbstractType::Handle(ParameterTypeAt(parameter_position)); | 6118 AbstractType::Handle(ParameterTypeAt(parameter_position)); |
| 6105 if (!param_type.IsInstantiated()) { | 6119 if (!param_type.IsInstantiated()) { |
| 6106 param_type = param_type.InstantiateFrom(type_arguments, bound_error); | 6120 param_type = param_type.InstantiateFrom( |
| 6121 type_arguments, bound_error, NULL /*trail*/, space); | |
| 6107 ASSERT((bound_error == NULL) || bound_error->IsNull()); | 6122 ASSERT((bound_error == NULL) || bound_error->IsNull()); |
| 6108 } | 6123 } |
| 6109 if (param_type.IsDynamicType()) { | 6124 if (param_type.IsDynamicType()) { |
| 6110 return test_kind == kIsSubtypeOf; | 6125 return test_kind == kIsSubtypeOf; |
| 6111 } | 6126 } |
| 6112 if (test_kind == kIsSubtypeOf) { | 6127 if (test_kind == kIsSubtypeOf) { |
| 6113 if (!param_type.IsSubtypeOf(other_param_type, bound_error) && | 6128 if (!param_type.IsSubtypeOf(other_param_type, bound_error, space) && |
| 6114 !other_param_type.IsSubtypeOf(param_type, bound_error)) { | 6129 !other_param_type.IsSubtypeOf(param_type, bound_error, space)) { |
| 6115 return false; | 6130 return false; |
| 6116 } | 6131 } |
| 6117 } else { | 6132 } else { |
| 6118 ASSERT(test_kind == kIsMoreSpecificThan); | 6133 ASSERT(test_kind == kIsMoreSpecificThan); |
| 6119 if (!param_type.IsMoreSpecificThan(other_param_type, bound_error)) { | 6134 if (!param_type.IsMoreSpecificThan(other_param_type, bound_error, space)) { |
| 6120 return false; | 6135 return false; |
| 6121 } | 6136 } |
| 6122 } | 6137 } |
| 6123 return true; | 6138 return true; |
| 6124 } | 6139 } |
| 6125 | 6140 |
| 6126 | 6141 |
| 6127 bool Function::TypeTest(TypeTestKind test_kind, | 6142 bool Function::TypeTest(TypeTestKind test_kind, |
| 6128 const TypeArguments& type_arguments, | 6143 const TypeArguments& type_arguments, |
| 6129 const Function& other, | 6144 const Function& other, |
| 6130 const TypeArguments& other_type_arguments, | 6145 const TypeArguments& other_type_arguments, |
| 6131 Error* bound_error) const { | 6146 Error* bound_error, |
| 6147 Heap::Space space) const { | |
| 6132 const intptr_t num_fixed_params = num_fixed_parameters(); | 6148 const intptr_t num_fixed_params = num_fixed_parameters(); |
| 6133 const intptr_t num_opt_pos_params = NumOptionalPositionalParameters(); | 6149 const intptr_t num_opt_pos_params = NumOptionalPositionalParameters(); |
| 6134 const intptr_t num_opt_named_params = NumOptionalNamedParameters(); | 6150 const intptr_t num_opt_named_params = NumOptionalNamedParameters(); |
| 6135 const intptr_t other_num_fixed_params = other.num_fixed_parameters(); | 6151 const intptr_t other_num_fixed_params = other.num_fixed_parameters(); |
| 6136 const intptr_t other_num_opt_pos_params = | 6152 const intptr_t other_num_opt_pos_params = |
| 6137 other.NumOptionalPositionalParameters(); | 6153 other.NumOptionalPositionalParameters(); |
| 6138 const intptr_t other_num_opt_named_params = | 6154 const intptr_t other_num_opt_named_params = |
| 6139 other.NumOptionalNamedParameters(); | 6155 other.NumOptionalNamedParameters(); |
| 6140 // This function requires the same arguments or less and accepts the same | 6156 // This function requires the same arguments or less and accepts the same |
| 6141 // arguments or more. | 6157 // arguments or more. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6179 return false; | 6195 return false; |
| 6180 } | 6196 } |
| 6181 } | 6197 } |
| 6182 } | 6198 } |
| 6183 // Check the types of fixed and optional positional parameters. | 6199 // Check the types of fixed and optional positional parameters. |
| 6184 for (intptr_t i = 0; i < (other_num_fixed_params - other_num_ignored_params + | 6200 for (intptr_t i = 0; i < (other_num_fixed_params - other_num_ignored_params + |
| 6185 other_num_opt_pos_params); i++) { | 6201 other_num_opt_pos_params); i++) { |
| 6186 if (!TestParameterType(test_kind, | 6202 if (!TestParameterType(test_kind, |
| 6187 i + num_ignored_params, i + other_num_ignored_params, | 6203 i + num_ignored_params, i + other_num_ignored_params, |
| 6188 type_arguments, other, other_type_arguments, | 6204 type_arguments, other, other_type_arguments, |
| 6189 bound_error)) { | 6205 bound_error, |
| 6206 space)) { | |
| 6190 return false; | 6207 return false; |
| 6191 } | 6208 } |
| 6192 } | 6209 } |
| 6193 // Check the names and types of optional named parameters. | 6210 // Check the names and types of optional named parameters. |
| 6194 if (other_num_opt_named_params == 0) { | 6211 if (other_num_opt_named_params == 0) { |
| 6195 return true; | 6212 return true; |
| 6196 } | 6213 } |
| 6197 // Check that for each optional named parameter of type T of the other | 6214 // Check that for each optional named parameter of type T of the other |
| 6198 // function type, there exists an optional named parameter of this function | 6215 // function type, there exists an optional named parameter of this function |
| 6199 // type with an identical name and with a type S that is a either a subtype | 6216 // type with an identical name and with a type S that is a either a subtype |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 6210 other_param_name = other.ParameterNameAt(i); | 6227 other_param_name = other.ParameterNameAt(i); |
| 6211 ASSERT(other_param_name.IsSymbol()); | 6228 ASSERT(other_param_name.IsSymbol()); |
| 6212 found_param_name = false; | 6229 found_param_name = false; |
| 6213 for (intptr_t j = num_fixed_params; j < num_params; j++) { | 6230 for (intptr_t j = num_fixed_params; j < num_params; j++) { |
| 6214 ASSERT(String::Handle(ParameterNameAt(j)).IsSymbol()); | 6231 ASSERT(String::Handle(ParameterNameAt(j)).IsSymbol()); |
| 6215 if (ParameterNameAt(j) == other_param_name.raw()) { | 6232 if (ParameterNameAt(j) == other_param_name.raw()) { |
| 6216 found_param_name = true; | 6233 found_param_name = true; |
| 6217 if (!TestParameterType(test_kind, | 6234 if (!TestParameterType(test_kind, |
| 6218 j, i, | 6235 j, i, |
| 6219 type_arguments, other, other_type_arguments, | 6236 type_arguments, other, other_type_arguments, |
| 6220 bound_error)) { | 6237 bound_error, |
| 6238 space)) { | |
| 6221 return false; | 6239 return false; |
| 6222 } | 6240 } |
| 6223 break; | 6241 break; |
| 6224 } | 6242 } |
| 6225 } | 6243 } |
| 6226 if (!found_param_name) { | 6244 if (!found_param_name) { |
| 6227 return false; | 6245 return false; |
| 6228 } | 6246 } |
| 6229 } | 6247 } |
| 6230 return true; | 6248 return true; |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6756 } else { | 6774 } else { |
| 6757 return PrettyName(); | 6775 return PrettyName(); |
| 6758 } | 6776 } |
| 6759 } else { | 6777 } else { |
| 6760 if (cls.IsTopLevel()) { | 6778 if (cls.IsTopLevel()) { |
| 6761 return PrettyName(); | 6779 return PrettyName(); |
| 6762 } else { | 6780 } else { |
| 6763 tmp = cls.PrettyName(); | 6781 tmp = cls.PrettyName(); |
| 6764 } | 6782 } |
| 6765 } | 6783 } |
| 6766 tmp = String::Concat(tmp, Symbols::Dot()); | 6784 tmp = String::Concat(tmp, Symbols::Dot(), Heap::kOld); |
| 6767 const String& suffix = String::Handle(PrettyName()); | 6785 const String& suffix = String::Handle(PrettyName()); |
| 6768 return String::Concat(tmp, suffix); | 6786 return String::Concat(tmp, suffix, Heap::kOld); |
| 6769 } | 6787 } |
| 6770 | 6788 |
| 6771 | 6789 |
| 6772 RawString* Function::QualifiedUserVisibleName() const { | 6790 RawString* Function::QualifiedUserVisibleName() const { |
| 6773 String& tmp = String::Handle(); | 6791 String& tmp = String::Handle(); |
| 6774 const Class& cls = Class::Handle(Owner()); | 6792 const Class& cls = Class::Handle(Owner()); |
| 6775 | 6793 |
| 6776 if (IsClosureFunction()) { | 6794 if (IsClosureFunction()) { |
| 6777 if (IsLocalFunction() && !IsImplicitClosureFunction()) { | 6795 if (IsLocalFunction() && !IsImplicitClosureFunction()) { |
| 6778 const Function& parent = Function::Handle(parent_function()); | 6796 const Function& parent = Function::Handle(parent_function()); |
| (...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9062 error = lib.TransitiveLoadError(); | 9080 error = lib.TransitiveLoadError(); |
| 9063 if (!error.IsNull()) { | 9081 if (!error.IsNull()) { |
| 9064 break; | 9082 break; |
| 9065 } | 9083 } |
| 9066 } | 9084 } |
| 9067 return error.raw(); | 9085 return error.raw(); |
| 9068 } | 9086 } |
| 9069 | 9087 |
| 9070 | 9088 |
| 9071 static RawString* MakeClassMetaName(const Class& cls) { | 9089 static RawString* MakeClassMetaName(const Class& cls) { |
| 9072 String& cname = String::Handle(cls.Name()); | 9090 GrowableHandlePtrArray<const String> pieces(Thread::Current()->zone(), 2); |
| 9073 return String::Concat(Symbols::At(), cname); | 9091 pieces.Add(Symbols::At()); |
| 9092 pieces.Add(String::Handle(cls.Name())); | |
| 9093 return Symbols::FromConcatAll(pieces); | |
|
hausner
2015/09/05 01:22:10
Can't you use the Symbols::FromConcat() here? Ther
srdjan
2015/09/06 05:24:10
Yes
| |
| 9074 } | 9094 } |
| 9075 | 9095 |
| 9076 | 9096 |
| 9077 static RawString* MakeFieldMetaName(const Field& field) { | 9097 static RawString* MakeFieldMetaName(const Field& field) { |
| 9078 const String& cname = | 9098 const String& cname = |
| 9079 String::Handle(MakeClassMetaName(Class::Handle(field.origin()))); | 9099 String::Handle(MakeClassMetaName(Class::Handle(field.origin()))); |
| 9080 String& fname = String::Handle(field.name()); | 9100 GrowableHandlePtrArray<const String> pieces(Thread::Current()->zone(), 3); |
| 9081 fname = String::Concat(Symbols::At(), fname); | 9101 pieces.Add(cname); |
| 9082 return String::Concat(cname, fname); | 9102 pieces.Add(Symbols::At()); |
| 9103 pieces.Add(String::Handle(field.name())); | |
| 9104 return Symbols::FromConcatAll(pieces); | |
| 9083 } | 9105 } |
| 9084 | 9106 |
| 9085 | 9107 |
| 9086 static RawString* MakeFunctionMetaName(const Function& func) { | 9108 static RawString* MakeFunctionMetaName(const Function& func) { |
| 9087 const String& cname = | 9109 const String& cname = |
| 9088 String::Handle(MakeClassMetaName(Class::Handle(func.origin()))); | 9110 String::Handle(MakeClassMetaName(Class::Handle(func.origin()))); |
| 9089 String& fname = String::Handle(func.QualifiedPrettyName()); | 9111 GrowableHandlePtrArray<const String> pieces(Thread::Current()->zone(), 3); |
| 9090 fname = String::Concat(Symbols::At(), fname); | 9112 pieces.Add(cname); |
| 9091 return String::Concat(cname, fname); | 9113 pieces.Add(Symbols::At()); |
| 9114 pieces.Add(String::Handle(func.QualifiedPrettyName())); | |
| 9115 return Symbols::FromConcatAll(pieces); | |
| 9092 } | 9116 } |
| 9093 | 9117 |
| 9094 | 9118 |
| 9095 static RawString* MakeTypeParameterMetaName(const TypeParameter& param) { | 9119 static RawString* MakeTypeParameterMetaName(const TypeParameter& param) { |
| 9096 const String& cname = String::Handle( | 9120 const String& cname = String::Handle( |
| 9097 MakeClassMetaName(Class::Handle(param.parameterized_class()))); | 9121 MakeClassMetaName(Class::Handle(param.parameterized_class()))); |
| 9098 String& pname = String::Handle(param.name()); | 9122 GrowableHandlePtrArray<const String> pieces(Thread::Current()->zone(), 3); |
| 9099 pname = String::Concat(Symbols::At(), pname); | 9123 pieces.Add(cname); |
| 9100 return String::Concat(cname, pname); | 9124 pieces.Add(Symbols::At()); |
| 9125 pieces.Add(String::Handle(param.name())); | |
| 9126 return Symbols::FromConcatAll(pieces); | |
| 9101 } | 9127 } |
| 9102 | 9128 |
| 9103 | 9129 |
| 9104 void Library::AddMetadata(const Class& cls, | 9130 void Library::AddMetadata(const Class& cls, |
| 9105 const String& name, | 9131 const String& name, |
| 9106 intptr_t token_pos) const { | 9132 intptr_t token_pos) const { |
| 9107 const String& metaname = String::Handle(Symbols::New(name)); | 9133 const String& metaname = String::Handle(Symbols::New(name)); |
| 9108 Field& field = Field::Handle(Field::New(metaname, | 9134 Field& field = Field::Handle(Field::New(metaname, |
| 9109 true, // is_static | 9135 true, // is_static |
| 9110 false, // is_final | 9136 false, // is_final |
| (...skipping 5427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14538 ASSERT(Isolate::Current()->flags().type_checks()); | 14564 ASSERT(Isolate::Current()->flags().type_checks()); |
| 14539 return false; | 14565 return false; |
| 14540 } | 14566 } |
| 14541 other_class = instantiated_other.type_class(); | 14567 other_class = instantiated_other.type_class(); |
| 14542 other_type_arguments = instantiated_other.arguments(); | 14568 other_type_arguments = instantiated_other.arguments(); |
| 14543 } else { | 14569 } else { |
| 14544 other_class = other.type_class(); | 14570 other_class = other.type_class(); |
| 14545 other_type_arguments = other.arguments(); | 14571 other_type_arguments = other.arguments(); |
| 14546 } | 14572 } |
| 14547 return cls.IsSubtypeOf(type_arguments, other_class, other_type_arguments, | 14573 return cls.IsSubtypeOf(type_arguments, other_class, other_type_arguments, |
| 14548 bound_error); | 14574 bound_error, Heap::kOld); |
| 14549 } | 14575 } |
| 14550 | 14576 |
| 14551 | 14577 |
| 14552 bool Instance::OperatorEquals(const Instance& other) const { | 14578 bool Instance::OperatorEquals(const Instance& other) const { |
| 14553 // TODO(koda): Optimize for all builtin classes and all classes | 14579 // TODO(koda): Optimize for all builtin classes and all classes |
| 14554 // that do not override operator==. | 14580 // that do not override operator==. |
| 14555 return DartLibraryCalls::Equals(*this, other) == Object::bool_true().raw(); | 14581 return DartLibraryCalls::Equals(*this, other) == Object::bool_true().raw(); |
| 14556 } | 14582 } |
| 14557 | 14583 |
| 14558 | 14584 |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15199 | 15225 |
| 15200 | 15226 |
| 15201 bool AbstractType::IsFunctionType() const { | 15227 bool AbstractType::IsFunctionType() const { |
| 15202 return HasResolvedTypeClass() && | 15228 return HasResolvedTypeClass() && |
| 15203 (type_class() == Type::Handle(Type::Function()).type_class()); | 15229 (type_class() == Type::Handle(Type::Function()).type_class()); |
| 15204 } | 15230 } |
| 15205 | 15231 |
| 15206 | 15232 |
| 15207 bool AbstractType::TypeTest(TypeTestKind test_kind, | 15233 bool AbstractType::TypeTest(TypeTestKind test_kind, |
| 15208 const AbstractType& other, | 15234 const AbstractType& other, |
| 15209 Error* bound_error) const { | 15235 Error* bound_error, |
| 15236 Heap::Space space) const { | |
| 15210 ASSERT(IsResolved()); | 15237 ASSERT(IsResolved()); |
| 15211 ASSERT(other.IsResolved()); | 15238 ASSERT(other.IsResolved()); |
| 15212 if (IsMalformed() || other.IsMalformed()) { | 15239 if (IsMalformed() || other.IsMalformed()) { |
| 15213 // Malformed types involved in subtype tests should be handled specially | 15240 // Malformed types involved in subtype tests should be handled specially |
| 15214 // by the caller. Malformed types should only be encountered here in a | 15241 // by the caller. Malformed types should only be encountered here in a |
| 15215 // more specific than test. | 15242 // more specific than test. |
| 15216 ASSERT(test_kind == kIsMoreSpecificThan); | 15243 ASSERT(test_kind == kIsMoreSpecificThan); |
| 15217 return false; | 15244 return false; |
| 15218 } | 15245 } |
| 15219 // In case the type checked in a type test is malbounded, the code generator | 15246 // In case the type checked in a type test is malbounded, the code generator |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15268 return false; // TODO(regis): We should return "maybe after instantiation". | 15295 return false; // TODO(regis): We should return "maybe after instantiation". |
| 15269 } | 15296 } |
| 15270 if (other.IsTypeParameter()) { | 15297 if (other.IsTypeParameter()) { |
| 15271 return false; // TODO(regis): We should return "maybe after instantiation". | 15298 return false; // TODO(regis): We should return "maybe after instantiation". |
| 15272 } | 15299 } |
| 15273 const Class& cls = Class::Handle(type_class()); | 15300 const Class& cls = Class::Handle(type_class()); |
| 15274 return cls.TypeTest(test_kind, | 15301 return cls.TypeTest(test_kind, |
| 15275 TypeArguments::Handle(arguments()), | 15302 TypeArguments::Handle(arguments()), |
| 15276 Class::Handle(other.type_class()), | 15303 Class::Handle(other.type_class()), |
| 15277 TypeArguments::Handle(other.arguments()), | 15304 TypeArguments::Handle(other.arguments()), |
| 15278 bound_error); | 15305 bound_error, |
| 15306 space); | |
| 15279 } | 15307 } |
| 15280 | 15308 |
| 15281 | 15309 |
| 15282 intptr_t AbstractType::Hash() const { | 15310 intptr_t AbstractType::Hash() const { |
| 15283 // AbstractType is an abstract class. | 15311 // AbstractType is an abstract class. |
| 15284 UNREACHABLE(); | 15312 UNREACHABLE(); |
| 15285 return 0; | 15313 return 0; |
| 15286 } | 15314 } |
| 15287 | 15315 |
| 15288 | 15316 |
| (...skipping 6235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 21524 return tag_label.ToCString(); | 21552 return tag_label.ToCString(); |
| 21525 } | 21553 } |
| 21526 | 21554 |
| 21527 | 21555 |
| 21528 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21556 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21529 Instance::PrintJSONImpl(stream, ref); | 21557 Instance::PrintJSONImpl(stream, ref); |
| 21530 } | 21558 } |
| 21531 | 21559 |
| 21532 | 21560 |
| 21533 } // namespace dart | 21561 } // namespace dart |
| OLD | NEW |