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

Unified Diff: runtime/vm/object.cc

Issue 18242003: Add a VM defined class MirrorReference as an opaque pointer for Dart code to VM internal objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
===================================================================
--- runtime/vm/object.cc (revision 24693)
+++ runtime/vm/object.cc (working copy)
@@ -929,6 +929,22 @@
object_store->set_weak_property_class(cls);
RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib);
+ // Pre-register the mirrors library so we can place the vm class
+ // MirrorReference there rather than the core library.
+ lib = Library::LookupLibrary(Symbols::DartMirrors());
+ if (lib.IsNull()) {
+ lib = Library::NewLibraryHelper(Symbols::DartMirrors(), true);
+ lib.Register();
+ isolate->object_store()->set_bootstrap_library(ObjectStore::kMirrors,
+ lib);
+ }
+ ASSERT(!lib.IsNull());
+ ASSERT(lib.raw() == Library::MirrorsLibrary());
+
+ cls = Class::New<MirrorReference>();
+ object_store->set_mirror_reference_class(cls);
+ RegisterPrivateClass(cls, Symbols::_MirrorReference(), lib);
+
// Setup some default native field classes which can be extended for
// specifying native fields in dart classes.
Library::InitNativeWrappersLibrary(isolate);
@@ -1199,6 +1215,9 @@
cls = Class::New<WeakProperty>();
object_store->set_weak_property_class(cls);
+
+ cls = Class::New<MirrorReference>();
+ object_store->set_mirror_reference_class(cls);
}
@@ -13671,4 +13690,20 @@
return "_WeakProperty";
}
+
+RawMirrorReference* MirrorReference::New(Heap::Space space) {
+ ASSERT(Isolate::Current()->object_store()->mirror_reference_class()
+ != Class::null());
+ RawObject* raw = Object::Allocate(MirrorReference::kClassId,
+ MirrorReference::InstanceSize(),
+ space);
+ return reinterpret_cast<RawMirrorReference*>(raw);
+}
+
+
+const char* MirrorReference::ToCString() const {
+ return "_MirrorReference";
+}
+
+
} // namespace dart
« 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