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

Unified Diff: runtime/vm/object.cc

Issue 10832199: Add a weak property type to the virtual machine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address final review comments Created 8 years, 4 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 cd2fad7871659dc8c416513933a99d858445529c..ed68ea7c0f86b0a28281157b42f05986996b7f27 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -624,6 +624,11 @@ RawError* Object::Init(Isolate* isolate) {
RegisterClass(cls, name, core_impl_lib);
pending_classes.Add(cls, Heap::kOld);
+ cls = Class::New<WeakProperty>();
+ object_store->set_weak_property_class(cls);
+ RegisterClass(cls, "WeakProperty", impl_script, core_impl_lib);
+ pending_classes.Add(cls, Heap::kOld);
+
// Initialize the base interfaces used by the core VM classes.
const Script& script = Script::Handle(Bootstrap::LoadCoreScript(false));
@@ -1024,6 +1029,9 @@ void Object::InitFromSnapshot(Isolate* isolate) {
cls = Class::New<JSRegExp>();
object_store->set_jsregexp_class(cls);
+ cls = Class::New<WeakProperty>();
+ object_store->set_weak_property_class(cls);
+
// Allocate pre-initialized values.
Bool& bool_value = Bool::Handle();
bool_value = Bool::New(true);
@@ -1758,7 +1766,7 @@ RawClass* Class::NewSignatureClass(const String& name,
RawClass* Class::GetClass(intptr_t class_id, bool is_signature_class) {
- if (class_id >= kIntegerCid && class_id <= kJSRegExpCid) {
+ if (class_id >= kIntegerCid && class_id <= kWeakPropertyCid) {
return Isolate::Current()->class_table()->At(class_id);
}
if (class_id >= kNumPredefinedCids) {
@@ -11311,4 +11319,24 @@ const char* JSRegExp::ToCString() const {
return chars;
}
+
+RawWeakProperty* WeakProperty::New(Heap::Space space) {
+ ASSERT(Isolate::Current()->object_store()->weak_property_class()
+ != Class::null());
+ WeakProperty& result = WeakProperty::Handle();
+ {
+ RawObject* raw = Object::Allocate(WeakProperty::kClassId,
+ WeakProperty::InstanceSize(),
+ space);
+ NoGCScope no_gc;
+ result ^= raw;
+ }
+ return result.raw();
+}
+
+
+const char* WeakProperty::ToCString() const {
+ return "WeakProperty";
+}
+
} // 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