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

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

Issue 1167583002: Canonicalize mixin type during class finalization. Add asserts that most types are canonical. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« runtime/lib/mirrors.cc ('K') | « runtime/lib/mirrors.cc ('k') | no next file » | 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 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 // In case of a bound error in the super type in production mode, the 2229 // In case of a bound error in the super type in production mode, the
2230 // finalized super type will have a BoundedType as type argument for the 2230 // finalized super type will have a BoundedType as type argument for the
2231 // out of bound type argument. 2231 // out of bound type argument.
2232 // It should not be a problem if the class is written to a snapshot and 2232 // It should not be a problem if the class is written to a snapshot and
2233 // later executed in checked mode. Note that the finalized type argument 2233 // later executed in checked mode. Note that the finalized type argument
2234 // vector of any type of the base class will contain a BoundedType for the 2234 // vector of any type of the base class will contain a BoundedType for the
2235 // out of bound type argument. 2235 // out of bound type argument.
2236 super_type = FinalizeType(cls, super_type, kCanonicalizeWellFormed); 2236 super_type = FinalizeType(cls, super_type, kCanonicalizeWellFormed);
2237 cls.set_super_type(super_type); 2237 cls.set_super_type(super_type);
2238 } 2238 }
2239 // Finalize mixin type.
2240 Type& mixin_type = Type::Handle(cls.mixin());
2241 if (!mixin_type.IsNull()) {
2242 mixin_type ^= FinalizeType(cls, mixin_type, kCanonicalizeWellFormed);
2243 cls.set_mixin(mixin_type);
2244 }
2239 if (cls.IsSignatureClass()) { 2245 if (cls.IsSignatureClass()) {
2240 // Check for illegal self references. 2246 // Check for illegal self references.
2241 GrowableArray<intptr_t> visited_aliases; 2247 GrowableArray<intptr_t> visited_aliases;
2242 if (!IsAliasCycleFree(cls, &visited_aliases)) { 2248 if (!IsAliasCycleFree(cls, &visited_aliases)) {
2243 const String& name = String::Handle(cls.Name()); 2249 const String& name = String::Handle(cls.Name());
2244 ReportError(cls, cls.token_pos(), 2250 ReportError(cls, cls.token_pos(),
2245 "typedef '%s' illegally refers to itself", 2251 "typedef '%s' illegally refers to itself",
2246 name.ToCString()); 2252 name.ToCString());
2247 } 2253 }
2248 cls.set_is_type_finalized(); 2254 cls.set_is_type_finalized();
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
3182 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); 3188 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields());
3183 field ^= fields_array.At(0); 3189 field ^= fields_array.At(0);
3184 ASSERT(field.Offset() == ByteBuffer::data_offset()); 3190 ASSERT(field.Offset() == ByteBuffer::data_offset());
3185 name ^= field.name(); 3191 name ^= field.name();
3186 expected_name ^= String::New("_data"); 3192 expected_name ^= String::New("_data");
3187 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 3193 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
3188 #endif 3194 #endif
3189 } 3195 }
3190 3196
3191 } // namespace dart 3197 } // namespace dart
OLDNEW
« runtime/lib/mirrors.cc ('K') | « runtime/lib/mirrors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698