Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 4ef02b7bfdc8bd81a66dd9d7dd8f34f1136cbe8a..be8a4e68f1216b7c454388fced77e37b88e569dc 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -716,6 +716,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()); |
| @@ -1060,6 +1065,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); |
| @@ -1827,6 +1835,9 @@ RawClass* Class::GetClass(ObjectKind kind) { |
| case kJSRegExp: |
| ASSERT(object_store->jsregexp_class() != Class::null()); |
| return object_store->jsregexp_class(); |
| + case kWeakProperty: |
| + ASSERT(object_store->weak_property_class() != Class::null()); |
| + return object_store->weak_property_class(); |
| case kClosure: |
| return Class::New<Closure>(); |
| case kInstance: |
| @@ -11193,4 +11204,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::kInstanceKind, |
| + WeakProperty::InstanceSize(), |
| + space); |
|
turnidge
2012/08/09 18:34:34
Just to double-check, does Object::Allocate set (k
cshapiro
2012/08/14 04:58:18
Yes, it should.
|
| + NoGCScope no_gc; |
| + result ^= raw; |
| + } |
| + return result.raw(); |
| +} |
| + |
| + |
| +const char* WeakProperty::ToCString() const { |
| + return "WeakProperty"; |
|
turnidge
2012/08/09 18:34:34
A thought: you could make the ToCString have some
cshapiro
2012/08/14 04:58:18
Yes, I could although I cannot think of anything n
|
| +} |
| + |
| } // namespace dart |