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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 18894)
+++ runtime/vm/object.cc (working copy)
@@ -698,8 +698,10 @@
GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld));
object_store->set_libraries(libraries);
- // Basic infrastructure has been setup, initialize the class dictionary.
+ // Pre-register the core library.
Library::InitCoreLibrary(isolate);
+
+ // Basic infrastructure has been setup, initialize the class dictionary.
Library& core_lib = Library::Handle(Library::CoreLibrary());
ASSERT(!core_lib.IsNull());
@@ -821,7 +823,20 @@
object_store->set_weak_property_class(cls);
RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib);
+ // Setup some default native field classes which can be extended for
+ // specifying native fields in dart classes.
+ Library::InitNativeWrappersLibrary(isolate);
+ ASSERT(isolate->object_store()->native_wrappers_library() != Library::null());
+
+ // Pre-register the remaining internal librarie.
+ Library::InitAsyncLibrary(isolate);
+ Library::InitCollectionLibrary(isolate);
+ Library::InitCollectionDevLibrary(isolate);
+ Library::InitMathLibrary(isolate);
+ Library::InitIsolateLibrary(isolate);
+ Library::InitMirrorsLibrary(isolate);
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.
+
Library& scalarlist_lib = Library::Handle(Library::ScalarlistLibrary());
cls = Class::New<Int8Array>();
@@ -993,11 +1008,6 @@
type = Type::NewNonParameterizedType(cls);
object_store->set_dynamic_type(type);
- // Setup some default native field classes which can be extended for
- // specifying native fields in dart classes.
- Library::InitNativeWrappersLibrary(isolate);
- ASSERT(isolate->object_store()->native_wrappers_library() != Library::null());
-
// Finish the initialization by compiling the bootstrap scripts containing the
// base interfaces and the implementation of the internal classes.
Error& error = Error::Handle();
@@ -1010,16 +1020,15 @@
if (!error.IsNull()) {
return error.raw();
}
- Library::InitASyncLibrary(isolate);
const Script& async_script =
- Script::Handle(Bootstrap::LoadASyncScript(false));
- const Library& async_lib = Library::Handle(Library::ASyncLibrary());
+ Script::Handle(Bootstrap::LoadAsyncScript(false));
+ const Library& async_lib = Library::Handle(Library::AsyncLibrary());
ASSERT(!async_lib.IsNull());
error = Bootstrap::Compile(async_lib, async_script);
if (!error.IsNull()) {
return error.raw();
}
- patch_script = Bootstrap::LoadASyncScript(true);
+ patch_script = Bootstrap::LoadAsyncScript(true);
error = async_lib.Patch(patch_script);
if (!error.IsNull()) {
return error.raw();
@@ -1056,7 +1065,6 @@
}
const Script& isolate_script = Script::Handle(
Bootstrap::LoadIsolateScript(false));
- Library::InitIsolateLibrary(isolate);
const Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
ASSERT(!isolate_lib.IsNull());
error = Bootstrap::Compile(isolate_lib, isolate_script);
@@ -1070,7 +1078,6 @@
}
const Script& mirrors_script = Script::Handle(
Bootstrap::LoadMirrorsScript(false));
- Library::InitMirrorsLibrary(isolate);
const Library& mirrors_lib = Library::Handle(Library::MirrorsLibrary());
ASSERT(!mirrors_lib.IsNull());
error = Bootstrap::Compile(mirrors_lib, mirrors_script);
@@ -6340,7 +6347,7 @@
}
-void Library::InitASyncLibrary(Isolate* isolate) {
+void Library::InitAsyncLibrary(Isolate* isolate) {
const String& url = Symbols::DartAsync();
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
@@ -6354,23 +6361,6 @@
Library::Handle(Library::NewLibraryHelper(core_lib_url, false));
core_lib.Register();
isolate->object_store()->set_core_library(core_lib);
- Library::InitMathLibrary(isolate);
- const Library& math_lib = Library::Handle(Library::MathLibrary());
- const Namespace& math_ns = Namespace::Handle(
- Namespace::New(math_lib, Array::Handle(), Array::Handle()));
- Library::InitCollectionDevLibrary(isolate);
- const Library& collection_dev_lib =
- Library::Handle(Library::CollectionDevLibrary());
- const Namespace& collection_dev_ns = Namespace::Handle(
- Namespace::New(collection_dev_lib, Array::Handle(), Array::Handle()));
- Library::InitCollectionLibrary(isolate);
- const Library& collection_lib =
- Library::Handle(Library::CollectionLibrary());
- const Namespace& collection_ns = Namespace::Handle(
- Namespace::New(collection_lib, Array::Handle(), Array::Handle()));
- core_lib.AddImport(math_ns);
- core_lib.AddImport(collection_ns);
- core_lib.AddImport(collection_dev_ns);
isolate->object_store()->set_root_library(Library::Handle());
// Hook up predefined classes without setting their library pointers. These
@@ -6385,15 +6375,6 @@
const String& url = Symbols::DartCollection();
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
- const Library& math_lib = Library::Handle(Library::MathLibrary());
- const Namespace& math_ns = Namespace::Handle(
- Namespace::New(math_lib, Array::Handle(), Array::Handle()));
- const Library& collection_dev_lib =
- Library::Handle(Library::CollectionDevLibrary());
- const Namespace& collection_dev_ns = Namespace::Handle(
- Namespace::New(collection_dev_lib, Array::Handle(), Array::Handle()));
- lib.AddImport(math_ns);
- lib.AddImport(collection_dev_ns);
isolate->object_store()->set_collection_library(lib);
}
@@ -6410,10 +6391,6 @@
const String& url = Symbols::DartCrypto();
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
- const Library& math_lib = Library::Handle(Library::MathLibrary());
- const Namespace& math_ns = Namespace::Handle(
- Namespace::New(math_lib, Array::Handle(), Array::Handle()));
- lib.AddImport(math_ns);
isolate->object_store()->set_crypto_library(lib);
}
@@ -6422,10 +6399,6 @@
const String& url = Symbols::DartIsolate();
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
- const Library& async_lib = Library::Handle(Library::ASyncLibrary());
- const Namespace& async_ns = Namespace::Handle(
- Namespace::New(async_lib, Array::Handle(), Array::Handle()));
- lib.AddImport(async_ns);
isolate->object_store()->set_isolate_library(lib);
}
@@ -6450,16 +6423,8 @@
const String& url = Symbols::DartMirrors();
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
- const Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
- const Namespace& isolate_ns = Namespace::Handle(
- Namespace::New(isolate_lib, Array::Handle(), Array::Handle()));
- lib.AddImport(isolate_ns);
- const Library& async_lib = Library::Handle(Library::ASyncLibrary());
- const Namespace& async_ns = Namespace::Handle(
- Namespace::New(async_lib, Array::Handle(), Array::Handle()));
- lib.AddImport(async_ns);
const Library& wrappers_lib =
- Library::Handle(Library::NativeWrappersLibrary());
+ Library::Handle(Library::NativeWrappersLibrary());
const Namespace& wrappers_ns = Namespace::Handle(
Namespace::New(wrappers_lib, Array::Handle(), Array::Handle()));
lib.AddImport(wrappers_ns);
@@ -6496,11 +6461,6 @@
const String& url = Symbols::DartScalarlist();
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
- const Library& collection_lib =
- Library::Handle(Library::CollectionLibrary());
- const Namespace& collection_ns = Namespace::Handle(
- Namespace::New(collection_lib, Array::Handle(), Array::Handle()));
- lib.AddImport(collection_ns);
isolate->object_store()->set_scalarlist_library(lib);
}
@@ -6509,14 +6469,6 @@
const String& url = Symbols::DartUri();
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
- const Library& math_lib = Library::Handle(Library::MathLibrary());
- const Namespace& math_ns = Namespace::Handle(
- Namespace::New(math_lib, Array::Handle(), Array::Handle()));
- const Library& utf_lib = Library::Handle(Library::UtfLibrary());
- const Namespace& utf_ns = Namespace::Handle(
- Namespace::New(utf_lib, Array::Handle(), Array::Handle()));
- lib.AddImport(math_ns);
- lib.AddImport(utf_ns);
isolate->object_store()->set_uri_library(lib);
}
@@ -6525,10 +6477,6 @@
const String& url = Symbols::DartUtf();
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
lib.Register();
- const Library& async_lib = Library::Handle(Library::ASyncLibrary());
- const Namespace& async_ns = Namespace::Handle(
- Namespace::New(async_lib, Array::Handle(), Array::Handle()));
- lib.AddImport(async_ns);
isolate->object_store()->set_utf_library(lib);
}
@@ -6626,7 +6574,7 @@
}
-RawLibrary* Library::ASyncLibrary() {
+RawLibrary* Library::AsyncLibrary() {
return Isolate::Current()->object_store()->async_library();
}
« 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