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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 type_arg = BoundedType::New(type_arg, instantiated_bound, type_param); | 986 type_arg = BoundedType::New(type_arg, instantiated_bound, type_param); |
987 arguments.SetTypeAt(offset + i, type_arg); | 987 arguments.SetTypeAt(offset + i, type_arg); |
988 continue; | 988 continue; |
989 } | 989 } |
990 // Shortcut the special case where we check a type parameter against its | 990 // Shortcut the special case where we check a type parameter against its |
991 // declared upper bound. | 991 // declared upper bound. |
992 if (error.IsNull() && | 992 if (error.IsNull() && |
993 !(type_arg.Equals(type_param) && | 993 !(type_arg.Equals(type_param) && |
994 instantiated_bound.Equals(declared_bound))) { | 994 instantiated_bound.Equals(declared_bound))) { |
995 // If type_arg is a type parameter, its declared bound may not be | 995 // If type_arg is a type parameter, its declared bound may not be |
996 // resolved yet. | 996 // finalized yet. |
997 if (type_arg.IsTypeParameter()) { | 997 if (type_arg.IsTypeParameter()) { |
998 const Class& type_arg_cls = Class::Handle( | 998 const Class& type_arg_cls = Class::Handle( |
999 TypeParameter::Cast(type_arg).parameterized_class()); | 999 TypeParameter::Cast(type_arg).parameterized_class()); |
1000 AbstractType& bound = AbstractType::Handle( | 1000 AbstractType& bound = AbstractType::Handle( |
1001 TypeParameter::Cast(type_arg).bound()); | 1001 TypeParameter::Cast(type_arg).bound()); |
1002 ResolveType(type_arg_cls, bound); | 1002 if (!bound.IsFinalized() && !bound.IsBeingFinalized()) { |
| 1003 bound = FinalizeType(type_arg_cls, bound, kCanonicalize); |
| 1004 TypeParameter::Cast(type_arg).set_bound(bound); |
| 1005 } |
1003 } | 1006 } |
1004 // This may be called only if type needs to be finalized, therefore | 1007 // This may be called only if type needs to be finalized, therefore |
1005 // seems OK to allocate finalized types in old space. | 1008 // seems OK to allocate finalized types in old space. |
1006 if (!type_param.CheckBound(type_arg, instantiated_bound, | 1009 if (!type_param.CheckBound(type_arg, instantiated_bound, |
1007 &error, NULL, Heap::kOld) && | 1010 &error, NULL, Heap::kOld) && |
1008 error.IsNull()) { | 1011 error.IsNull()) { |
1009 // The bound cannot be checked at compile time; postpone to run time. | 1012 // The bound cannot be checked at compile time; postpone to run time. |
1010 type_arg = BoundedType::New(type_arg, instantiated_bound, type_param); | 1013 type_arg = BoundedType::New(type_arg, instantiated_bound, type_param); |
1011 arguments.SetTypeAt(offset + i, type_arg); | 1014 arguments.SetTypeAt(offset + i, type_arg); |
1012 } | 1015 } |
(...skipping 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3315 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); | 3318 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); |
3316 field ^= fields_array.At(0); | 3319 field ^= fields_array.At(0); |
3317 ASSERT(field.Offset() == ByteBuffer::data_offset()); | 3320 ASSERT(field.Offset() == ByteBuffer::data_offset()); |
3318 name ^= field.name(); | 3321 name ^= field.name(); |
3319 expected_name ^= String::New("_data"); | 3322 expected_name ^= String::New("_data"); |
3320 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 3323 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
3321 #endif | 3324 #endif |
3322 } | 3325 } |
3323 | 3326 |
3324 } // namespace dart | 3327 } // namespace dart |
OLD | NEW |