Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 29c32628347dcf0f08772df870f25fbe8f9ad408..e55581a10660398e7a21e48792e3ba197eec1519 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -91,7 +91,6 @@ LanguageError* Object::snapshot_writer_error_ = NULL; |
| RawObject* Object::null_ = reinterpret_cast<RawObject*>(RAW_NULL); |
| RawClass* Object::class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| -RawClass* Object::null_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| RawClass* Object::dynamic_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| RawClass* Object::void_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| RawClass* Object::unresolved_class_class_ = |
| @@ -413,7 +412,7 @@ void Object::InitOnce() { |
| cls = Class::New<Instance>(kNullCid); |
| cls.set_is_finalized(); |
| cls.set_is_type_finalized(); |
| - null_class_ = cls.raw(); |
| + isolate->object_store()->set_null_class(cls); |
| // Allocate and initialize the free list element class. |
| cls = Class::New<FreeListElement::FakeInstance>(kFreeListElement); |
| @@ -612,7 +611,6 @@ void Object::RegisterSingletonClassNames() { |
| // Set up names for all VM singleton classes. |
| SET_CLASS_NAME(class, Class); |
| - SET_CLASS_NAME(null, Null); |
| SET_CLASS_NAME(dynamic, Dynamic); |
| SET_CLASS_NAME(void, Void); |
| SET_CLASS_NAME(unresolved_class, UnresolvedClass); |
| @@ -833,6 +831,20 @@ RawError* Object::Init(Isolate* isolate) { |
| RegisterClass(cls, Symbols::Bool(), core_lib); |
| pending_classes.Add(cls, Heap::kOld); |
| + cls = Class::New<Instance>(kNullCid); |
| + cls.set_name(Symbols::Null()); |
| + // We immediately mark Null as finalized because it has no corresponding |
| + // source. |
| + cls.set_is_finalized(); |
| + cls.set_is_type_finalized(); |
| + object_store->set_null_class(cls); |
| + cls.set_library(core_lib); // A sort of fiction for the mirrors. |
| + // When/if we promote Null to an ordinary class, it should be added to the |
| + // core library, given source and added to the list of classes pending |
| + // finalization. |
| + // RegisterClass(cls, Symbols::Null(), core_lib); |
| + // pending_classes.Add(cls, Heap::kOld); |
| + |
| cls = object_store->array_class(); // Was allocated above. |
| RegisterPrivateClass(cls, Symbols::ObjectArray(), core_lib); |
| pending_classes.Add(cls, Heap::kOld); |
| @@ -1095,10 +1107,14 @@ RawError* Object::Init(Isolate* isolate) { |
| // because their names are reserved keywords. Their names are not heap |
| // allocated, because the classes reside in the VM isolate. |
|
rmacnak
2013/08/09 17:45:44
Not sure why this would prevent heap allocation. I
Ivan Posva
2013/08/09 21:15:12
It looks like this comment is out-of-date. The nam
|
| // The corresponding types are stored in the object store. |
| - cls = null_class(); |
| + cls = object_store->null_class(); |
| type = Type::NewNonParameterizedType(cls); |
| object_store->set_null_type(type); |
| + // Consider removing when/if Null becomes an ordinary class. |
| + type = object_store->object_type(); |
| + cls.set_super_type(type); |
| + |
| cls = void_class(); |
| type = Type::NewNonParameterizedType(cls); |
| object_store->set_void_type(type); |
| @@ -1211,6 +1227,9 @@ void Object::InitFromSnapshot(Isolate* isolate) { |
| cls = Class::New<Bool>(); |
| object_store->set_bool_class(cls); |
| + cls = Class::New<Instance>(kNullCid); |
| + object_store->set_null_class(cls); |
| + |
| cls = Class::New<Stacktrace>(); |
| object_store->set_stacktrace_class(cls); |
| @@ -10434,6 +10453,12 @@ RawString* AbstractType::ClassName() const { |
| } |
| +bool AbstractType::IsNullType() const { |
| + return HasResolvedTypeClass() && |
|
rmacnak
2013/08/09 17:45:44
This mimics Bool, but perhaps type_class().IsNullC
|
| + (type_class() == Type::Handle(Type::NullType()).type_class()); |
| +} |
| + |
| + |
| bool AbstractType::IsBoolType() const { |
| return HasResolvedTypeClass() && |
| (type_class() == Type::Handle(Type::BoolType()).type_class()); |