Chromium Code Reviews| Index: vm/snapshot.cc |
| =================================================================== |
| --- vm/snapshot.cc (revision 5947) |
| +++ vm/snapshot.cc (working copy) |
| @@ -219,7 +219,6 @@ |
| cls_ = Object::class_class(); |
| RawClass* obj = reinterpret_cast<RawClass*>( |
| AllocateUninitialized(cls_, Class::InstanceSize())); |
| - obj->ptr()->instance_kind_ = object_kind; |
| if (object_kind == kInstance) { |
| Instance fake; |
| obj->ptr()->handle_vtable_ = fake.vtable(); |
| @@ -227,7 +226,11 @@ |
| Closure fake; |
| obj->ptr()->handle_vtable_ = fake.vtable(); |
| } |
| - return obj; |
| + const Class& cls = Class::Handle(obj); |
|
siva
2012/04/02 18:29:21
cls_ = obj;
That way we avoid the creation of a
Ivan Posva
2012/04/29 21:08:25
Done.
|
| + cls.set_instance_kind(object_kind); |
| + cls.set_index(kIllegalObjectKind); |
| + isolate()->class_table()->Register(cls); |
| + return cls.raw(); |
| } |
| return Class::GetClass(object_kind); |
| } |
| @@ -361,6 +364,9 @@ |
| RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); |
| raw_obj->ptr()->class_ = cls.raw(); |
| uword tags = 0; |
| + intptr_t index = cls.index(); |
| + ASSERT(index != kIllegalObjectKind); |
| + tags = RawObject::ClassTag::update(index, tags); |
| tags = RawObject::SizeTag::update(size, tags); |
| raw_obj->ptr()->tags_ = tags; |
| return raw_obj; |