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

Unified Diff: runtime/vm/object.cc

Issue 12313088: First step towards implementing dart:typeddata library. (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 18956)
+++ runtime/vm/object.cc (working copy)
@@ -1094,6 +1094,22 @@
if (!error.IsNull()) {
return error.raw();
}
+
+ Library::InitTypedDataLibrary(isolate);
+ Library& typeddata_lib = Library::Handle(Library::TypedDataLibrary());
+ ASSERT(!typeddata_lib.IsNull());
+ const Script& typeddata_script = Script::Handle(
+ Bootstrap::LoadTypedDataScript(false));
+ error = Bootstrap::Compile(typeddata_lib, typeddata_script);
+ if (!error.IsNull()) {
+ return error.raw();
+ }
+ patch_script = Bootstrap::LoadTypedDataScript(true);
+ error = typeddata_lib.Patch(patch_script);
+ if (!error.IsNull()) {
+ return error.raw();
+ }
+
Library& lib = Library::Handle();
INIT_LIBRARY(Crypto,
Bootstrap::LoadCryptoScript(false),
@@ -6510,6 +6526,28 @@
}
+void Library::InitTypedDataLibrary(Isolate* isolate) {
+ const Array& null_array = Array::Handle();
+ Library& import_lib = Library::Handle();
+ Namespace& import_ns = Namespace::Handle();
+ const String& url = Symbols::DartTypedData();
+ const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
+ lib.Register();
+
+ import_lib = Library::CollectionLibrary();
+ import_ns = Namespace::New(import_lib, null_array, null_array);
+ lib.AddImport(import_ns);
+
+ const String& import_prefix = String::Handle(Symbols::New("sl"));
+ import_lib = Library::ScalarlistLibrary();
+ import_ns = Namespace::New(import_lib, null_array, null_array);
+ const LibraryPrefix& library_prefix = LibraryPrefix::Handle(
+ LibraryPrefix::New(import_prefix, import_ns));
+ lib.AddObject(library_prefix, import_prefix);
+ isolate->object_store()->set_typeddata_library(lib);
+}
+
+
void Library::InitUriLibrary(Isolate* isolate) {
const String& url = Symbols::DartUri();
const Library& lib = Library::Handle(Library::NewLibraryHelper(url, true));
@@ -6686,6 +6724,11 @@
}
+RawLibrary* Library::TypedDataLibrary() {
+ return Isolate::Current()->object_store()->typeddata_library();
+}
+
+
RawLibrary* Library::UriLibrary() {
return Isolate::Current()->object_store()->uri_library();
}

Powered by Google App Engine
This is Rietveld 408576698