Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Side by Side Diff: runtime/vm/class_finalizer.cc

Issue 1886633002: Properly handle unfinalized type parameters of generic mixins (fixes #26230). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698