Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index e1f31d992e78312ec6788f01b486427afeaefd1e..a7fd6762491cf054aa3fb5476f5d1a1a02fd4743 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -598,6 +598,11 @@ RawError* Object::Init(Isolate* isolate) { |
RegisterClass(cls, "JSSyntaxRegExp", impl_script, 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::LoadScript()); |
@@ -938,6 +943,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); |
@@ -1587,7 +1595,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) { |
@@ -11034,4 +11042,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 |