Chromium Code Reviews| Index: runtime/vm/object.h |
| diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
| index 1169efb476c0abb81741a7030d74b3c3afc0f4d4..71eb07920d7ebb0494d0b3ab67df49450be96e6b 100644 |
| --- a/runtime/vm/object.h |
| +++ b/runtime/vm/object.h |
| @@ -5355,6 +5355,60 @@ class JSRegExp : public Instance { |
| }; |
| +class WeakProperty : public Instance { |
| + public: |
| + RawObject* key() const { |
| + return raw_ptr()->key_; |
| + } |
| + |
| + void set_key(const Object& key) { |
| + StorePointer(&raw_ptr()->key_, key.raw()); |
| + } |
| + |
| + RawObject* value() const { |
| + return raw_ptr()->value_; |
| + } |
| + |
| + void set_value(const Object& value) { |
| + StorePointer(&raw_ptr()->value_, value.raw()); |
| + } |
| + |
| + static RawWeakProperty* New(Heap::Space space = Heap::kNew); |
| + |
| + static intptr_t InstanceSize() { |
| + return RoundedAllocationSize(sizeof(RawWeakProperty)); |
| + } |
| + |
| + static void Clear(RawWeakProperty* raw_weak) { |
|
turnidge
2012/08/09 18:34:34
These static functions (Clear/Pop/Push) all are ex
cshapiro
2012/08/14 04:58:18
Removed. Done.
|
| + raw_weak->ptr()->key_ = Object::null(); |
| + raw_weak->ptr()->value_ = Object::null(); |
| + } |
| + |
| + static RawWeakProperty* Pop(RawWeakProperty** queue) { |
|
turnidge
2012/08/09 18:34:34
Not sure if this is technically a 'queue'. Seems
cshapiro
2012/08/14 04:58:18
True. This method has been removed. Done.
|
| + ASSERT(queue != NULL); |
| + RawWeakProperty* result = WeakProperty::null(); |
| + if (*queue != WeakProperty::null()) { |
| + result = *queue; |
| + RawWeakProperty* next = result->ptr()->next_; |
| + result->ptr()->next_ = WeakProperty::null(); |
| + *queue = next; |
| + } |
| + return result; |
| + } |
| + |
| + static void Push(RawWeakProperty* raw_weak, RawWeakProperty** queue) { |
| + ASSERT(queue != NULL); |
| + RawWeakProperty* next = *queue; |
| + raw_weak->ptr()->next_ = next; |
| + *queue = raw_weak; |
| + } |
| + |
| + private: |
| + HEAP_OBJECT_IMPLEMENTATION(WeakProperty, Instance); |
| + friend class Class; |
| +}; |
| + |
| + |
| // Breaking cycles and loops. |
| RawClass* Object::clazz() const { |
| uword raw_value = reinterpret_cast<uword>(raw_); |