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 |