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

Side by Side Diff: vm/class_finalizer.cc

Issue 8537023: Implement automatic loading of dart:core_native_fields library (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/flags.h" 7 #include "vm/flags.h"
8 #include "vm/heap.h" 8 #include "vm/heap.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 } 989 }
990 // Mark as finalized before resolving type parameter upper bounds and member 990 // Mark as finalized before resolving type parameter upper bounds and member
991 // types in order to break cycles. 991 // types in order to break cycles.
992 cls.Finalize(); 992 cls.Finalize();
993 ResolveAndFinalizeUpperBounds(cls); 993 ResolveAndFinalizeUpperBounds(cls);
994 ResolveAndFinalizeMemberTypes(cls); 994 ResolveAndFinalizeMemberTypes(cls);
995 // Run additional checks after all types are finalized. 995 // Run additional checks after all types are finalized.
996 if (cls.is_const()) { 996 if (cls.is_const()) {
997 CheckForLegalConstClass(cls); 997 CheckForLegalConstClass(cls);
998 } 998 }
999 // Check to ensure we don't have classes with native fields in libraries
1000 // which do not have a native resolver.
1001 if (cls.num_native_fields() != 0) {
1002 const Library& lib = Library::Handle(cls.library());
1003 if (lib.native_entry_resolver() == NULL) {
1004 const String& cls_name = String::Handle(cls.Name());
1005 const String& lib_name = String::Handle(lib.url());
1006 ReportError("class '%s' is trying to extend a native fields class,"
1007 "but library '%s' has no native resolvers",
1008 cls_name.ToCString(), lib_name.ToCString());
1009 }
1010 }
999 } 1011 }
1000 1012
1001 1013
1002 bool ClassFinalizer::IsSuperCycleFree(const Class& cls) { 1014 bool ClassFinalizer::IsSuperCycleFree(const Class& cls) {
1003 Class& test1 = Class::Handle(cls.raw()); 1015 Class& test1 = Class::Handle(cls.raw());
1004 Class& test2 = Class::Handle(cls.SuperClass()); 1016 Class& test2 = Class::Handle(cls.SuperClass());
1005 // A finalized class has been checked for cycles. 1017 // A finalized class has been checked for cycles.
1006 // Using the hare and tortoise algorithm for locating cycles. 1018 // Using the hare and tortoise algorithm for locating cycles.
1007 while (!test1.is_finalized() && 1019 while (!test1.is_finalized() &&
1008 !test2.IsNull() && !test2.is_finalized()) { 1020 !test2.IsNull() && !test2.is_finalized()) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 va_end(args); 1271 va_end(args);
1260 if (FLAG_warning_as_error) { 1272 if (FLAG_warning_as_error) {
1261 isolate->long_jump_base()->Jump(1, msg_buffer); 1273 isolate->long_jump_base()->Jump(1, msg_buffer);
1262 UNREACHABLE(); 1274 UNREACHABLE();
1263 } else { 1275 } else {
1264 OS::Print(msg_buffer); 1276 OS::Print(msg_buffer);
1265 } 1277 }
1266 } 1278 }
1267 1279
1268 } // namespace dart 1280 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698