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

Unified Diff: runtime/vm/object.cc

Issue 10919267: Introduce a VM-only dart:scalarlist library for byte arrays. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move init call for scalarlist lib Created 8 years, 3 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index ae36909cd43394ef04314361a052e13b29b92242..faa7773abf8c2cac6e27c4aaf770d9bfe48b86b2 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -687,110 +687,113 @@ RawError* Object::Init(Isolate* isolate) {
RegisterPrivateClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
+ cls = Class::New<WeakProperty>();
+ object_store->set_weak_property_class(cls);
+ name = Symbols::_WeakProperty();
+ RegisterPrivateClass(cls, name, core_lib);
+
+ Library::InitScalarlistLibrary(isolate);
+ Library& scalarlist_lib = Library::Handle(Library::ScalarlistLibrary());
+
cls = Class::New<Int8Array>();
object_store->set_int8_array_class(cls);
name = Symbols::_Int8Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<Uint8Array>();
object_store->set_uint8_array_class(cls);
name = Symbols::_Uint8Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<Int16Array>();
object_store->set_int16_array_class(cls);
name = Symbols::_Int16Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<Uint16Array>();
object_store->set_uint16_array_class(cls);
name = Symbols::_Uint16Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<Int32Array>();
object_store->set_int32_array_class(cls);
name = Symbols::_Int32Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<Uint32Array>();
object_store->set_uint32_array_class(cls);
name = Symbols::_Uint32Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<Int64Array>();
object_store->set_int64_array_class(cls);
name = Symbols::_Int64Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<Uint64Array>();
object_store->set_uint64_array_class(cls);
name = Symbols::_Uint64Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<Float32Array>();
object_store->set_float32_array_class(cls);
name = Symbols::_Float32Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<Float64Array>();
object_store->set_float64_array_class(cls);
name = Symbols::_Float64Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<ExternalInt8Array>();
object_store->set_external_int8_array_class(cls);
name = Symbols::_ExternalInt8Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<ExternalUint8Array>();
object_store->set_external_uint8_array_class(cls);
name = Symbols::_ExternalUint8Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<ExternalInt16Array>();
object_store->set_external_int16_array_class(cls);
name = Symbols::_ExternalInt16Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<ExternalUint16Array>();
object_store->set_external_uint16_array_class(cls);
name = Symbols::_ExternalUint16Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<ExternalInt32Array>();
object_store->set_external_int32_array_class(cls);
name = Symbols::_ExternalInt32Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<ExternalUint32Array>();
object_store->set_external_uint32_array_class(cls);
name = Symbols::_ExternalUint32Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<ExternalInt64Array>();
object_store->set_external_int64_array_class(cls);
name = Symbols::_ExternalInt64Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<ExternalUint64Array>();
object_store->set_external_uint64_array_class(cls);
name = Symbols::_ExternalUint64Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<ExternalFloat32Array>();
object_store->set_external_float32_array_class(cls);
name = Symbols::_ExternalFloat32Array();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
cls = Class::New<ExternalFloat64Array>();
object_store->set_external_float64_array_class(cls);
name = Symbols::_ExternalFloat64Array();
- RegisterPrivateClass(cls, name, core_lib);
-
- cls = Class::New<WeakProperty>();
- object_store->set_weak_property_class(cls);
- name = Symbols::_WeakProperty();
- RegisterPrivateClass(cls, name, core_lib);
+ RegisterPrivateClass(cls, name, scalarlist_lib);
// Set the super type of class Stacktrace to Object type so that the
// 'toString' method is implemented.
@@ -947,6 +950,18 @@ RawError* Object::Init(Isolate* isolate) {
if (!error.IsNull()) {
return error.raw();
}
+ const Script& scalarlist_script = Script::Handle(
+ Bootstrap::LoadScalarlistScript(false));
+ ASSERT(!scalarlist_lib.IsNull());
+ error = Bootstrap::Compile(scalarlist_lib, scalarlist_script);
+ if (!error.IsNull()) {
+ return error.raw();
+ }
+ patch_script = Bootstrap::LoadScalarlistScript(true);
+ error = scalarlist_lib.Patch(patch_script);
+ if (!error.IsNull()) {
+ return error.raw();
+ }
Bootstrap::SetupNativeResolver();
// Remove the Object superclass cycle by setting the super type to null (not
@@ -6606,6 +6621,16 @@ void Library::InitMirrorsLibrary(Isolate* isolate) {
}
+void Library::InitScalarlistLibrary(Isolate* isolate) {
+ const String& url = String::Handle(Symbols::New("dart:scalarlist"));
+ const Library& lib = Library::Handle(Library::New(url));
+ lib.Register();
+ const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
+ lib.AddImport(core_impl_lib);
+ isolate->object_store()->set_scalarlist_library(lib);
+}
+
+
void Library::InitNativeWrappersLibrary(Isolate* isolate) {
static const int kNumNativeWrappersClasses = 4;
ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10);
@@ -6734,6 +6759,11 @@ RawLibrary* Library::MirrorsLibrary() {
}
+RawLibrary* Library::ScalarlistLibrary() {
+ return Isolate::Current()->object_store()->scalarlist_library();
+}
+
+
RawLibrary* Library::NativeWrappersLibrary() {
return Isolate::Current()->object_store()->native_wrappers_library();
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698