| 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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 if (FLAG_trace_type_finalization && super_type_arg.IsTypeRef()) { | 708 if (FLAG_trace_type_finalization && super_type_arg.IsTypeRef()) { |
| 709 AbstractType& ref_type = AbstractType::Handle( | 709 AbstractType& ref_type = AbstractType::Handle( |
| 710 TypeRef::Cast(super_type_arg).type()); | 710 TypeRef::Cast(super_type_arg).type()); |
| 711 ISL_Print("Instantiating TypeRef '%s': '%s'\n" | 711 ISL_Print("Instantiating TypeRef '%s': '%s'\n" |
| 712 " instantiator: '%s'\n", | 712 " instantiator: '%s'\n", |
| 713 String::Handle(super_type_arg.Name()).ToCString(), | 713 String::Handle(super_type_arg.Name()).ToCString(), |
| 714 ref_type.ToCString(), | 714 ref_type.ToCString(), |
| 715 arguments.ToCString()); | 715 arguments.ToCString()); |
| 716 } | 716 } |
| 717 Error& error = Error::Handle(); | 717 Error& error = Error::Handle(); |
| 718 super_type_arg = | 718 super_type_arg = super_type_arg.InstantiateFrom( |
| 719 super_type_arg.InstantiateFrom(arguments, &error, trail); | 719 arguments, &error, trail, Heap::kOld); |
| 720 if (!error.IsNull()) { | 720 if (!error.IsNull()) { |
| 721 // InstantiateFrom does not report an error if the type is still | 721 // InstantiateFrom does not report an error if the type is still |
| 722 // uninstantiated. Instead, it will return a new BoundedType so | 722 // uninstantiated. Instead, it will return a new BoundedType so |
| 723 // that the check is postponed to run time. | 723 // that the check is postponed to run time. |
| 724 ASSERT(super_type_arg.IsInstantiated()); | 724 ASSERT(super_type_arg.IsInstantiated()); |
| 725 // Keep only the first bound error. | 725 // Keep only the first bound error. |
| 726 if (bound_error->IsNull()) { | 726 if (bound_error->IsNull()) { |
| 727 *bound_error = error.raw(); | 727 *bound_error = error.raw(); |
| 728 } | 728 } |
| 729 } | 729 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 declared_bound = FinalizeType(cls, declared_bound, kCanonicalize); | 811 declared_bound = FinalizeType(cls, declared_bound, kCanonicalize); |
| 812 type_param.set_bound(declared_bound); | 812 type_param.set_bound(declared_bound); |
| 813 } | 813 } |
| 814 ASSERT(declared_bound.IsFinalized() || declared_bound.IsBeingFinalized()); | 814 ASSERT(declared_bound.IsFinalized() || declared_bound.IsBeingFinalized()); |
| 815 Error& error = Error::Handle(); | 815 Error& error = Error::Handle(); |
| 816 // Note that the bound may be malformed, in which case the bound check | 816 // Note that the bound may be malformed, in which case the bound check |
| 817 // will return an error and the bound check will be postponed to run time. | 817 // will return an error and the bound check will be postponed to run time. |
| 818 if (declared_bound.IsInstantiated()) { | 818 if (declared_bound.IsInstantiated()) { |
| 819 instantiated_bound = declared_bound.raw(); | 819 instantiated_bound = declared_bound.raw(); |
| 820 } else { | 820 } else { |
| 821 instantiated_bound = declared_bound.InstantiateFrom(arguments, &error); | 821 instantiated_bound = |
| 822 declared_bound.InstantiateFrom(arguments, &error, NULL, Heap::kOld); |
| 822 } | 823 } |
| 823 if (!instantiated_bound.IsFinalized()) { | 824 if (!instantiated_bound.IsFinalized()) { |
| 824 // The bound refers to type parameters, creating a cycle; postpone | 825 // The bound refers to type parameters, creating a cycle; postpone |
| 825 // bound check to run time, when the bound will be finalized. | 826 // bound check to run time, when the bound will be finalized. |
| 826 // The bound may not necessarily be 'IsBeingFinalized' yet, as is the | 827 // The bound may not necessarily be 'IsBeingFinalized' yet, as is the |
| 827 // case with a pair of type parameters of the same class referring to | 828 // case with a pair of type parameters of the same class referring to |
| 828 // each other via their bounds. | 829 // each other via their bounds. |
| 829 type_arg = BoundedType::New(type_arg, instantiated_bound, type_param); | 830 type_arg = BoundedType::New(type_arg, instantiated_bound, type_param); |
| 830 arguments.SetTypeAt(offset + i, type_arg); | 831 arguments.SetTypeAt(offset + i, type_arg); |
| 831 continue; | 832 continue; |
| (...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3217 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); | 3218 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); |
| 3218 field ^= fields_array.At(0); | 3219 field ^= fields_array.At(0); |
| 3219 ASSERT(field.Offset() == ByteBuffer::data_offset()); | 3220 ASSERT(field.Offset() == ByteBuffer::data_offset()); |
| 3220 name ^= field.name(); | 3221 name ^= field.name(); |
| 3221 expected_name ^= String::New("_data"); | 3222 expected_name ^= String::New("_data"); |
| 3222 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 3223 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
| 3223 #endif | 3224 #endif |
| 3224 } | 3225 } |
| 3225 | 3226 |
| 3226 } // namespace dart | 3227 } // namespace dart |
| OLD | NEW |