| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/class_finalizer.h" | 5 #include "vm/class_finalizer.h" |
| 6 | 6 |
| 7 #include "vm/code_generator.h" | 7 #include "vm/code_generator.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 // several type argument vectors may be mutually recursive and finalized at the | 648 // several type argument vectors may be mutually recursive and finalized at the |
| 649 // same time. Canonicalization happens when pending types are processed. | 649 // same time. Canonicalization happens when pending types are processed. |
| 650 // The trail is required to correctly instantiate a recursive type argument | 650 // The trail is required to correctly instantiate a recursive type argument |
| 651 // of the super type. | 651 // of the super type. |
| 652 void ClassFinalizer::FinalizeTypeArguments( | 652 void ClassFinalizer::FinalizeTypeArguments( |
| 653 const Class& cls, | 653 const Class& cls, |
| 654 const TypeArguments& arguments, | 654 const TypeArguments& arguments, |
| 655 intptr_t num_uninitialized_arguments, | 655 intptr_t num_uninitialized_arguments, |
| 656 Error* bound_error, | 656 Error* bound_error, |
| 657 GrowableObjectArray* pending_types, | 657 GrowableObjectArray* pending_types, |
| 658 GrowableObjectArray* trail) { | 658 TrailPtr trail) { |
| 659 ASSERT(arguments.Length() >= cls.NumTypeArguments()); | 659 ASSERT(arguments.Length() >= cls.NumTypeArguments()); |
| 660 if (!cls.is_type_finalized()) { | 660 if (!cls.is_type_finalized()) { |
| 661 FinalizeTypeParameters(cls, pending_types); | 661 FinalizeTypeParameters(cls, pending_types); |
| 662 ResolveUpperBounds(cls); | 662 ResolveUpperBounds(cls); |
| 663 } | 663 } |
| 664 AbstractType& super_type = AbstractType::Handle(cls.super_type()); | 664 AbstractType& super_type = AbstractType::Handle(cls.super_type()); |
| 665 if (!super_type.IsNull()) { | 665 if (!super_type.IsNull()) { |
| 666 const Class& super_class = Class::Handle(super_type.type_class()); | 666 const Class& super_class = Class::Handle(super_type.type_class()); |
| 667 const intptr_t num_super_type_params = super_class.NumTypeParameters(); | 667 const intptr_t num_super_type_params = super_class.NumTypeParameters(); |
| 668 const intptr_t num_super_type_args = super_class.NumTypeArguments(); | 668 const intptr_t num_super_type_args = super_class.NumTypeArguments(); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 Class& owner_class = Class::Handle(isolate); | 1085 Class& owner_class = Class::Handle(isolate); |
| 1086 if (type_class.IsSignatureClass()) { | 1086 if (type_class.IsSignatureClass()) { |
| 1087 const Function& signature_fun = | 1087 const Function& signature_fun = |
| 1088 Function::Handle(isolate, type_class.signature_function()); | 1088 Function::Handle(isolate, type_class.signature_function()); |
| 1089 ASSERT(!signature_fun.is_static()); | 1089 ASSERT(!signature_fun.is_static()); |
| 1090 owner_class = signature_fun.Owner(); | 1090 owner_class = signature_fun.Owner(); |
| 1091 } else { | 1091 } else { |
| 1092 owner_class = type_class.raw(); | 1092 owner_class = type_class.raw(); |
| 1093 } | 1093 } |
| 1094 if (offset > 0) { | 1094 if (offset > 0) { |
| 1095 GrowableObjectArray& trail = | 1095 TrailPtr trail = new Trail(4); |
| 1096 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); | |
| 1097 FinalizeTypeArguments(owner_class, full_arguments, offset, | 1096 FinalizeTypeArguments(owner_class, full_arguments, offset, |
| 1098 &bound_error, pending_types, &trail); | 1097 &bound_error, pending_types, trail); |
| 1099 } | 1098 } |
| 1100 if (full_arguments.IsRaw(0, num_type_arguments)) { | 1099 if (full_arguments.IsRaw(0, num_type_arguments)) { |
| 1101 // The parameterized_type is raw. Set its argument vector to null, which | 1100 // The parameterized_type is raw. Set its argument vector to null, which |
| 1102 // is more efficient in type tests. | 1101 // is more efficient in type tests. |
| 1103 full_arguments = TypeArguments::null(); | 1102 full_arguments = TypeArguments::null(); |
| 1104 } | 1103 } |
| 1105 parameterized_type.set_arguments(full_arguments); | 1104 parameterized_type.set_arguments(full_arguments); |
| 1106 } else { | 1105 } else { |
| 1107 ASSERT(full_arguments.IsNull()); // Use null vector for raw type. | 1106 ASSERT(full_arguments.IsNull()); // Use null vector for raw type. |
| 1108 } | 1107 } |
| (...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3218 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); | 3217 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); |
| 3219 field ^= fields_array.At(0); | 3218 field ^= fields_array.At(0); |
| 3220 ASSERT(field.Offset() == ByteBuffer::data_offset()); | 3219 ASSERT(field.Offset() == ByteBuffer::data_offset()); |
| 3221 name ^= field.name(); | 3220 name ^= field.name(); |
| 3222 expected_name ^= String::New("_data"); | 3221 expected_name ^= String::New("_data"); |
| 3223 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 3222 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
| 3224 #endif | 3223 #endif |
| 3225 } | 3224 } |
| 3226 | 3225 |
| 3227 } // namespace dart | 3226 } // namespace dart |
| OLD | NEW |