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

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

Issue 12321082: - Properly load the core libraries as libraries and not as scripts. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 object_store->set_two_byte_string_class(cls); 691 object_store->set_two_byte_string_class(cls);
692 692
693 // Setup the symbol table for the symbols created in the isolate. 693 // Setup the symbol table for the symbols created in the isolate.
694 Symbols::SetupSymbolTable(isolate); 694 Symbols::SetupSymbolTable(isolate);
695 695
696 // Set up the libraries array before initializing the core library. 696 // Set up the libraries array before initializing the core library.
697 const GrowableObjectArray& libraries = 697 const GrowableObjectArray& libraries =
698 GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld)); 698 GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld));
699 object_store->set_libraries(libraries); 699 object_store->set_libraries(libraries);
700 700
701 // Pre-register the core library.
702 Library::InitCoreLibrary(isolate);
703
701 // Basic infrastructure has been setup, initialize the class dictionary. 704 // Basic infrastructure has been setup, initialize the class dictionary.
702 Library::InitCoreLibrary(isolate);
703 Library& core_lib = Library::Handle(Library::CoreLibrary()); 705 Library& core_lib = Library::Handle(Library::CoreLibrary());
704 ASSERT(!core_lib.IsNull()); 706 ASSERT(!core_lib.IsNull());
705 707
706 const GrowableObjectArray& pending_classes = 708 const GrowableObjectArray& pending_classes =
707 GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld)); 709 GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld));
708 object_store->set_pending_classes(pending_classes); 710 object_store->set_pending_classes(pending_classes);
709 711
710 Context& context = Context::Handle(Context::New(0, Heap::kOld)); 712 Context& context = Context::Handle(Context::New(0, Heap::kOld));
711 object_store->set_empty_context(context); 713 object_store->set_empty_context(context);
712 714
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 816
815 cls = Class::New<Double>(); 817 cls = Class::New<Double>();
816 object_store->set_double_class(cls); 818 object_store->set_double_class(cls);
817 RegisterPrivateClass(cls, Symbols::_Double(), core_lib); 819 RegisterPrivateClass(cls, Symbols::_Double(), core_lib);
818 pending_classes.Add(cls, Heap::kOld); 820 pending_classes.Add(cls, Heap::kOld);
819 821
820 cls = Class::New<WeakProperty>(); 822 cls = Class::New<WeakProperty>();
821 object_store->set_weak_property_class(cls); 823 object_store->set_weak_property_class(cls);
822 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); 824 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib);
823 825
826 // Setup some default native field classes which can be extended for
827 // specifying native fields in dart classes.
828 Library::InitNativeWrappersLibrary(isolate);
829 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null());
830
831 // Pre-register the remaining internal librarie.
832 Library::InitAsyncLibrary(isolate);
833 Library::InitCollectionLibrary(isolate);
834 Library::InitCollectionDevLibrary(isolate);
835 Library::InitMathLibrary(isolate);
836 Library::InitIsolateLibrary(isolate);
837 Library::InitMirrorsLibrary(isolate);
824 Library::InitScalarlistLibrary(isolate); 838 Library::InitScalarlistLibrary(isolate);
siva 2013/02/23 00:11:03 When we clean up the library init stuff some of th
Ivan Posva 2013/02/25 22:20:14 Already cleaned up.
839
825 Library& scalarlist_lib = Library::Handle(Library::ScalarlistLibrary()); 840 Library& scalarlist_lib = Library::Handle(Library::ScalarlistLibrary());
826 841
827 cls = Class::New<Int8Array>(); 842 cls = Class::New<Int8Array>();
828 object_store->set_int8_array_class(cls); 843 object_store->set_int8_array_class(cls);
829 RegisterPrivateClass(cls, Symbols::_Int8Array(), scalarlist_lib); 844 RegisterPrivateClass(cls, Symbols::_Int8Array(), scalarlist_lib);
830 845
831 cls = Class::New<Uint8Array>(); 846 cls = Class::New<Uint8Array>();
832 object_store->set_uint8_array_class(cls); 847 object_store->set_uint8_array_class(cls);
833 RegisterPrivateClass(cls, Symbols::_Uint8Array(), scalarlist_lib); 848 RegisterPrivateClass(cls, Symbols::_Uint8Array(), scalarlist_lib);
834 849
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 object_store->set_void_type(type); 1001 object_store->set_void_type(type);
987 1002
988 // The class 'dynamic' is registered in the class dictionary because its name 1003 // The class 'dynamic' is registered in the class dictionary because its name
989 // is a built-in identifier, rather than a reserved keyword. Its name is not 1004 // is a built-in identifier, rather than a reserved keyword. Its name is not
990 // heap allocated, because the class resides in the VM isolate. 1005 // heap allocated, because the class resides in the VM isolate.
991 // The corresponding type, the "unknown type", is stored in the object store. 1006 // The corresponding type, the "unknown type", is stored in the object store.
992 cls = dynamic_class(); 1007 cls = dynamic_class();
993 type = Type::NewNonParameterizedType(cls); 1008 type = Type::NewNonParameterizedType(cls);
994 object_store->set_dynamic_type(type); 1009 object_store->set_dynamic_type(type);
995 1010
996 // Setup some default native field classes which can be extended for
997 // specifying native fields in dart classes.
998 Library::InitNativeWrappersLibrary(isolate);
999 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null());
1000
1001 // Finish the initialization by compiling the bootstrap scripts containing the 1011 // Finish the initialization by compiling the bootstrap scripts containing the
1002 // base interfaces and the implementation of the internal classes. 1012 // base interfaces and the implementation of the internal classes.
1003 Error& error = Error::Handle(); 1013 Error& error = Error::Handle();
1004 error = Bootstrap::Compile(core_lib, script); 1014 error = Bootstrap::Compile(core_lib, script);
1005 if (!error.IsNull()) { 1015 if (!error.IsNull()) {
1006 return error.raw(); 1016 return error.raw();
1007 } 1017 }
1008 Script& patch_script = Script::Handle(Bootstrap::LoadCoreScript(true)); 1018 Script& patch_script = Script::Handle(Bootstrap::LoadCoreScript(true));
1009 error = core_lib.Patch(patch_script); 1019 error = core_lib.Patch(patch_script);
1010 if (!error.IsNull()) { 1020 if (!error.IsNull()) {
1011 return error.raw(); 1021 return error.raw();
1012 } 1022 }
1013 Library::InitASyncLibrary(isolate);
1014 const Script& async_script = 1023 const Script& async_script =
1015 Script::Handle(Bootstrap::LoadASyncScript(false)); 1024 Script::Handle(Bootstrap::LoadAsyncScript(false));
1016 const Library& async_lib = Library::Handle(Library::ASyncLibrary()); 1025 const Library& async_lib = Library::Handle(Library::AsyncLibrary());
1017 ASSERT(!async_lib.IsNull()); 1026 ASSERT(!async_lib.IsNull());
1018 error = Bootstrap::Compile(async_lib, async_script); 1027 error = Bootstrap::Compile(async_lib, async_script);
1019 if (!error.IsNull()) { 1028 if (!error.IsNull()) {
1020 return error.raw(); 1029 return error.raw();
1021 } 1030 }
1022 patch_script = Bootstrap::LoadASyncScript(true); 1031 patch_script = Bootstrap::LoadAsyncScript(true);
1023 error = async_lib.Patch(patch_script); 1032 error = async_lib.Patch(patch_script);
1024 if (!error.IsNull()) { 1033 if (!error.IsNull()) {
1025 return error.raw(); 1034 return error.raw();
1026 } 1035 }
1027 const Script& collection_script = 1036 const Script& collection_script =
1028 Script::Handle(Bootstrap::LoadCollectionScript(false)); 1037 Script::Handle(Bootstrap::LoadCollectionScript(false));
1029 const Library& collection_lib = 1038 const Library& collection_lib =
1030 Library::Handle(Library::CollectionLibrary()); 1039 Library::Handle(Library::CollectionLibrary());
1031 ASSERT(!collection_lib.IsNull()); 1040 ASSERT(!collection_lib.IsNull());
1032 error = Bootstrap::Compile(collection_lib, collection_script); 1041 error = Bootstrap::Compile(collection_lib, collection_script);
(...skipping 16 matching lines...) Expand all
1049 if (!error.IsNull()) { 1058 if (!error.IsNull()) {
1050 return error.raw(); 1059 return error.raw();
1051 } 1060 }
1052 patch_script = Bootstrap::LoadMathScript(true); 1061 patch_script = Bootstrap::LoadMathScript(true);
1053 error = math_lib.Patch(patch_script); 1062 error = math_lib.Patch(patch_script);
1054 if (!error.IsNull()) { 1063 if (!error.IsNull()) {
1055 return error.raw(); 1064 return error.raw();
1056 } 1065 }
1057 const Script& isolate_script = Script::Handle( 1066 const Script& isolate_script = Script::Handle(
1058 Bootstrap::LoadIsolateScript(false)); 1067 Bootstrap::LoadIsolateScript(false));
1059 Library::InitIsolateLibrary(isolate);
1060 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); 1068 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
1061 ASSERT(!isolate_lib.IsNull()); 1069 ASSERT(!isolate_lib.IsNull());
1062 error = Bootstrap::Compile(isolate_lib, isolate_script); 1070 error = Bootstrap::Compile(isolate_lib, isolate_script);
1063 if (!error.IsNull()) { 1071 if (!error.IsNull()) {
1064 return error.raw(); 1072 return error.raw();
1065 } 1073 }
1066 patch_script = Bootstrap::LoadIsolateScript(true); 1074 patch_script = Bootstrap::LoadIsolateScript(true);
1067 error = isolate_lib.Patch(patch_script); 1075 error = isolate_lib.Patch(patch_script);
1068 if (!error.IsNull()) { 1076 if (!error.IsNull()) {
1069 return error.raw(); 1077 return error.raw();
1070 } 1078 }
1071 const Script& mirrors_script = Script::Handle( 1079 const Script& mirrors_script = Script::Handle(
1072 Bootstrap::LoadMirrorsScript(false)); 1080 Bootstrap::LoadMirrorsScript(false));
1073 Library::InitMirrorsLibrary(isolate);
1074 const Library& mirrors_lib = Library::Handle(Library::MirrorsLibrary()); 1081 const Library& mirrors_lib = Library::Handle(Library::MirrorsLibrary());
1075 ASSERT(!mirrors_lib.IsNull()); 1082 ASSERT(!mirrors_lib.IsNull());
1076 error = Bootstrap::Compile(mirrors_lib, mirrors_script); 1083 error = Bootstrap::Compile(mirrors_lib, mirrors_script);
1077 if (!error.IsNull()) { 1084 if (!error.IsNull()) {
1078 return error.raw(); 1085 return error.raw();
1079 } 1086 }
1080 patch_script = Bootstrap::LoadMirrorsScript(true); 1087 patch_script = Bootstrap::LoadMirrorsScript(true);
1081 error = mirrors_lib.Patch(patch_script); 1088 error = mirrors_lib.Patch(patch_script);
1082 if (!error.IsNull()) { 1089 if (!error.IsNull()) {
1083 return error.raw(); 1090 return error.raw();
(...skipping 5249 matching lines...) Expand 10 before | Expand all | Expand 10 after
6333 } 6340 }
6334 return result.raw(); 6341 return result.raw();
6335 } 6342 }
6336 6343
6337 6344
6338 RawLibrary* Library::New(const String& url) { 6345 RawLibrary* Library::New(const String& url) {
6339 return NewLibraryHelper(url, false); 6346 return NewLibraryHelper(url, false);
6340 } 6347 }
6341 6348
6342 6349
6343 void Library::InitASyncLibrary(Isolate* isolate) { 6350 void Library::InitAsyncLibrary(Isolate* isolate) {
6344 const String& url = Symbols::DartAsync(); 6351 const String& url = Symbols::DartAsync();
6345 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6352 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6346 lib.Register(); 6353 lib.Register();
6347 isolate->object_store()->set_async_library(lib); 6354 isolate->object_store()->set_async_library(lib);
6348 } 6355 }
6349 6356
6350 6357
6351 void Library::InitCoreLibrary(Isolate* isolate) { 6358 void Library::InitCoreLibrary(Isolate* isolate) {
6352 const String& core_lib_url = Symbols::DartCore(); 6359 const String& core_lib_url = Symbols::DartCore();
6353 const Library& core_lib = 6360 const Library& core_lib =
6354 Library::Handle(Library::NewLibraryHelper(core_lib_url, false)); 6361 Library::Handle(Library::NewLibraryHelper(core_lib_url, false));
6355 core_lib.Register(); 6362 core_lib.Register();
6356 isolate->object_store()->set_core_library(core_lib); 6363 isolate->object_store()->set_core_library(core_lib);
6357 Library::InitMathLibrary(isolate);
6358 const Library& math_lib = Library::Handle(Library::MathLibrary());
6359 const Namespace& math_ns = Namespace::Handle(
6360 Namespace::New(math_lib, Array::Handle(), Array::Handle()));
6361 Library::InitCollectionDevLibrary(isolate);
6362 const Library& collection_dev_lib =
6363 Library::Handle(Library::CollectionDevLibrary());
6364 const Namespace& collection_dev_ns = Namespace::Handle(
6365 Namespace::New(collection_dev_lib, Array::Handle(), Array::Handle()));
6366 Library::InitCollectionLibrary(isolate);
6367 const Library& collection_lib =
6368 Library::Handle(Library::CollectionLibrary());
6369 const Namespace& collection_ns = Namespace::Handle(
6370 Namespace::New(collection_lib, Array::Handle(), Array::Handle()));
6371 core_lib.AddImport(math_ns);
6372 core_lib.AddImport(collection_ns);
6373 core_lib.AddImport(collection_dev_ns);
6374 isolate->object_store()->set_root_library(Library::Handle()); 6364 isolate->object_store()->set_root_library(Library::Handle());
6375 6365
6376 // Hook up predefined classes without setting their library pointers. These 6366 // Hook up predefined classes without setting their library pointers. These
6377 // classes are coming from the VM isolate, and are shared between multiple 6367 // classes are coming from the VM isolate, and are shared between multiple
6378 // isolates so setting their library pointers would be wrong. 6368 // isolates so setting their library pointers would be wrong.
6379 const Class& cls = Class::Handle(Object::dynamic_class()); 6369 const Class& cls = Class::Handle(Object::dynamic_class());
6380 core_lib.AddObject(cls, String::Handle(cls.Name())); 6370 core_lib.AddObject(cls, String::Handle(cls.Name()));
6381 } 6371 }
6382 6372
6383 6373
6384 void Library::InitCollectionLibrary(Isolate* isolate) { 6374 void Library::InitCollectionLibrary(Isolate* isolate) {
6385 const String& url = Symbols::DartCollection(); 6375 const String& url = Symbols::DartCollection();
6386 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6376 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6387 lib.Register(); 6377 lib.Register();
6388 const Library& math_lib = Library::Handle(Library::MathLibrary());
6389 const Namespace& math_ns = Namespace::Handle(
6390 Namespace::New(math_lib, Array::Handle(), Array::Handle()));
6391 const Library& collection_dev_lib =
6392 Library::Handle(Library::CollectionDevLibrary());
6393 const Namespace& collection_dev_ns = Namespace::Handle(
6394 Namespace::New(collection_dev_lib, Array::Handle(), Array::Handle()));
6395 lib.AddImport(math_ns);
6396 lib.AddImport(collection_dev_ns);
6397 isolate->object_store()->set_collection_library(lib); 6378 isolate->object_store()->set_collection_library(lib);
6398 } 6379 }
6399 6380
6400 6381
6401 void Library::InitCollectionDevLibrary(Isolate* isolate) { 6382 void Library::InitCollectionDevLibrary(Isolate* isolate) {
6402 const String& url = Symbols::DartCollectionDev(); 6383 const String& url = Symbols::DartCollectionDev();
6403 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6384 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6404 lib.Register(); 6385 lib.Register();
6405 isolate->object_store()->set_collection_dev_library(lib); 6386 isolate->object_store()->set_collection_dev_library(lib);
6406 } 6387 }
6407 6388
6408 6389
6409 void Library::InitCryptoLibrary(Isolate* isolate) { 6390 void Library::InitCryptoLibrary(Isolate* isolate) {
6410 const String& url = Symbols::DartCrypto(); 6391 const String& url = Symbols::DartCrypto();
6411 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6392 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6412 lib.Register(); 6393 lib.Register();
6413 const Library& math_lib = Library::Handle(Library::MathLibrary());
6414 const Namespace& math_ns = Namespace::Handle(
6415 Namespace::New(math_lib, Array::Handle(), Array::Handle()));
6416 lib.AddImport(math_ns);
6417 isolate->object_store()->set_crypto_library(lib); 6394 isolate->object_store()->set_crypto_library(lib);
6418 } 6395 }
6419 6396
6420 6397
6421 void Library::InitIsolateLibrary(Isolate* isolate) { 6398 void Library::InitIsolateLibrary(Isolate* isolate) {
6422 const String& url = Symbols::DartIsolate(); 6399 const String& url = Symbols::DartIsolate();
6423 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6400 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6424 lib.Register(); 6401 lib.Register();
6425 const Library& async_lib = Library::Handle(Library::ASyncLibrary());
6426 const Namespace& async_ns = Namespace::Handle(
6427 Namespace::New(async_lib, Array::Handle(), Array::Handle()));
6428 lib.AddImport(async_ns);
6429 isolate->object_store()->set_isolate_library(lib); 6402 isolate->object_store()->set_isolate_library(lib);
6430 } 6403 }
6431 6404
6432 6405
6433 void Library::InitJsonLibrary(Isolate* isolate) { 6406 void Library::InitJsonLibrary(Isolate* isolate) {
6434 const String& url = Symbols::DartJson(); 6407 const String& url = Symbols::DartJson();
6435 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6408 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6436 lib.Register(); 6409 lib.Register();
6437 isolate->object_store()->set_json_library(lib); 6410 isolate->object_store()->set_json_library(lib);
6438 } 6411 }
6439 6412
6440 6413
6441 void Library::InitMathLibrary(Isolate* isolate) { 6414 void Library::InitMathLibrary(Isolate* isolate) {
6442 const String& url = Symbols::DartMath(); 6415 const String& url = Symbols::DartMath();
6443 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6416 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6444 lib.Register(); 6417 lib.Register();
6445 isolate->object_store()->set_math_library(lib); 6418 isolate->object_store()->set_math_library(lib);
6446 } 6419 }
6447 6420
6448 6421
6449 void Library::InitMirrorsLibrary(Isolate* isolate) { 6422 void Library::InitMirrorsLibrary(Isolate* isolate) {
6450 const String& url = Symbols::DartMirrors(); 6423 const String& url = Symbols::DartMirrors();
6451 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6424 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6452 lib.Register(); 6425 lib.Register();
6453 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
6454 const Namespace& isolate_ns = Namespace::Handle(
6455 Namespace::New(isolate_lib, Array::Handle(), Array::Handle()));
6456 lib.AddImport(isolate_ns);
6457 const Library& async_lib = Library::Handle(Library::ASyncLibrary());
6458 const Namespace& async_ns = Namespace::Handle(
6459 Namespace::New(async_lib, Array::Handle(), Array::Handle()));
6460 lib.AddImport(async_ns);
6461 const Library& wrappers_lib = 6426 const Library& wrappers_lib =
6462 Library::Handle(Library::NativeWrappersLibrary()); 6427 Library::Handle(Library::NativeWrappersLibrary());
6463 const Namespace& wrappers_ns = Namespace::Handle( 6428 const Namespace& wrappers_ns = Namespace::Handle(
6464 Namespace::New(wrappers_lib, Array::Handle(), Array::Handle())); 6429 Namespace::New(wrappers_lib, Array::Handle(), Array::Handle()));
6465 lib.AddImport(wrappers_ns); 6430 lib.AddImport(wrappers_ns);
6466 isolate->object_store()->set_mirrors_library(lib); 6431 isolate->object_store()->set_mirrors_library(lib);
6467 } 6432 }
6468 6433
6469 6434
6470 void Library::InitNativeWrappersLibrary(Isolate* isolate) { 6435 void Library::InitNativeWrappersLibrary(Isolate* isolate) {
6471 static const int kNumNativeWrappersClasses = 4; 6436 static const int kNumNativeWrappersClasses = 4;
6472 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); 6437 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10);
(...skipping 16 matching lines...) Expand all
6489 cls_name = Symbols::New(name_buffer); 6454 cls_name = Symbols::New(name_buffer);
6490 Class::NewNativeWrapper(native_flds_lib, cls_name, fld_cnt); 6455 Class::NewNativeWrapper(native_flds_lib, cls_name, fld_cnt);
6491 } 6456 }
6492 } 6457 }
6493 6458
6494 6459
6495 void Library::InitScalarlistLibrary(Isolate* isolate) { 6460 void Library::InitScalarlistLibrary(Isolate* isolate) {
6496 const String& url = Symbols::DartScalarlist(); 6461 const String& url = Symbols::DartScalarlist();
6497 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6462 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6498 lib.Register(); 6463 lib.Register();
6499 const Library& collection_lib =
6500 Library::Handle(Library::CollectionLibrary());
6501 const Namespace& collection_ns = Namespace::Handle(
6502 Namespace::New(collection_lib, Array::Handle(), Array::Handle()));
6503 lib.AddImport(collection_ns);
6504 isolate->object_store()->set_scalarlist_library(lib); 6464 isolate->object_store()->set_scalarlist_library(lib);
6505 } 6465 }
6506 6466
6507 6467
6508 void Library::InitUriLibrary(Isolate* isolate) { 6468 void Library::InitUriLibrary(Isolate* isolate) {
6509 const String& url = Symbols::DartUri(); 6469 const String& url = Symbols::DartUri();
6510 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6470 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6511 lib.Register(); 6471 lib.Register();
6512 const Library& math_lib = Library::Handle(Library::MathLibrary());
6513 const Namespace& math_ns = Namespace::Handle(
6514 Namespace::New(math_lib, Array::Handle(), Array::Handle()));
6515 const Library& utf_lib = Library::Handle(Library::UtfLibrary());
6516 const Namespace& utf_ns = Namespace::Handle(
6517 Namespace::New(utf_lib, Array::Handle(), Array::Handle()));
6518 lib.AddImport(math_ns);
6519 lib.AddImport(utf_ns);
6520 isolate->object_store()->set_uri_library(lib); 6472 isolate->object_store()->set_uri_library(lib);
6521 } 6473 }
6522 6474
6523 6475
6524 void Library::InitUtfLibrary(Isolate* isolate) { 6476 void Library::InitUtfLibrary(Isolate* isolate) {
6525 const String& url = Symbols::DartUtf(); 6477 const String& url = Symbols::DartUtf();
6526 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true)); 6478 const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
6527 lib.Register(); 6479 lib.Register();
6528 const Library& async_lib = Library::Handle(Library::ASyncLibrary());
6529 const Namespace& async_ns = Namespace::Handle(
6530 Namespace::New(async_lib, Array::Handle(), Array::Handle()));
6531 lib.AddImport(async_ns);
6532 isolate->object_store()->set_utf_library(lib); 6480 isolate->object_store()->set_utf_library(lib);
6533 } 6481 }
6534 6482
6535 6483
6536 RawLibrary* Library::LookupLibrary(const String &url) { 6484 RawLibrary* Library::LookupLibrary(const String &url) {
6537 Isolate* isolate = Isolate::Current(); 6485 Isolate* isolate = Isolate::Current();
6538 Library& lib = Library::Handle(isolate, Library::null()); 6486 Library& lib = Library::Handle(isolate, Library::null());
6539 String& lib_url = String::Handle(isolate, String::null()); 6487 String& lib_url = String::Handle(isolate, String::null());
6540 GrowableObjectArray& libs = GrowableObjectArray::Handle( 6488 GrowableObjectArray& libs = GrowableObjectArray::Handle(
6541 isolate, isolate->object_store()->libraries()); 6489 isolate, isolate->object_store()->libraries());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
6619 ASSERT(Library::LookupLibrary(String::Handle(url())) == Library::null()); 6567 ASSERT(Library::LookupLibrary(String::Handle(url())) == Library::null());
6620 ObjectStore* object_store = Isolate::Current()->object_store(); 6568 ObjectStore* object_store = Isolate::Current()->object_store();
6621 GrowableObjectArray& libs = 6569 GrowableObjectArray& libs =
6622 GrowableObjectArray::Handle(object_store->libraries()); 6570 GrowableObjectArray::Handle(object_store->libraries());
6623 ASSERT(!libs.IsNull()); 6571 ASSERT(!libs.IsNull());
6624 set_index(libs.Length()); 6572 set_index(libs.Length());
6625 libs.Add(*this); 6573 libs.Add(*this);
6626 } 6574 }
6627 6575
6628 6576
6629 RawLibrary* Library::ASyncLibrary() { 6577 RawLibrary* Library::AsyncLibrary() {
6630 return Isolate::Current()->object_store()->async_library(); 6578 return Isolate::Current()->object_store()->async_library();
6631 } 6579 }
6632 6580
6633 6581
6634 RawLibrary* Library::CoreLibrary() { 6582 RawLibrary* Library::CoreLibrary() {
6635 return Isolate::Current()->object_store()->core_library(); 6583 return Isolate::Current()->object_store()->core_library();
6636 } 6584 }
6637 6585
6638 6586
6639 RawLibrary* Library::CollectionLibrary() { 6587 RawLibrary* Library::CollectionLibrary() {
(...skipping 6352 matching lines...) Expand 10 before | Expand all | Expand 10 after
12992 } 12940 }
12993 return result.raw(); 12941 return result.raw();
12994 } 12942 }
12995 12943
12996 12944
12997 const char* WeakProperty::ToCString() const { 12945 const char* WeakProperty::ToCString() const {
12998 return "_WeakProperty"; 12946 return "_WeakProperty";
12999 } 12947 }
13000 12948
13001 } // namespace dart 12949 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/parser.h » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698