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

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 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
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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_store.h » ('j') | runtime/vm/scavenger.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698