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

Unified Diff: vm/snapshot.cc

Issue 9965042: - Add a class index to the classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 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
« vm/object.h ('K') | « vm/raw_object.cc ('k') | vm/stub_code_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« vm/object.h ('K') | « vm/raw_object.cc ('k') | vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698