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

Unified Diff: vm/object.h

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
Index: vm/object.h
===================================================================
--- vm/object.h (revision 5947)
+++ vm/object.h (working copy)
@@ -362,7 +362,7 @@
RawObject* raw_; // The raw object reference.
private:
- static void InitializeObject(uword address, intptr_t size);
+ static void InitializeObject(uword address, intptr_t index, intptr_t size);
cpp_vtable* vtable_address() const {
return reinterpret_cast<cpp_vtable*>(reinterpret_cast<word>(this));
@@ -451,10 +451,15 @@
}
ObjectKind instance_kind() const { return raw_ptr()->instance_kind_; }
- void set_instance_kind(ObjectKind value) {
+ void set_instance_kind(ObjectKind value) const {
raw_ptr()->instance_kind_ = value;
}
+ intptr_t index() const { return raw_ptr()->index_; }
+ void set_index(intptr_t value) const {
+ raw_ptr()->index_ = value;
+ }
+
RawString* Name() const;
RawScript* script() const { return raw_ptr()->script_; }
@@ -662,11 +667,6 @@
// Allocate a class used for VM internal objects.
template <class FakeObject> static RawClass* New();
- // Allocate an instance class which has a VM implementation.
- template <class FakeInstance> static RawClass* New(const String& name,
- const Script& script,
- intptr_t token_index);
-
// Allocate instance classes and interfaces.
static RawClass* New(const String& name,
const Script& script,
@@ -715,6 +715,12 @@
intptr_t prefix_length,
const String& name) const;
+ // Allocate an instance class which has a VM implementation.
+ template <class FakeInstance> static RawClass* New(intptr_t index);
+ template <class FakeInstance> static RawClass* New(const String& name,
+ const Script& script,
+ intptr_t token_index);
+
HEAP_OBJECT_IMPLEMENTATION(Class, Object);
friend class Object;
friend class Instance;
@@ -3848,7 +3854,10 @@
if ((raw_value & kSmiTagMask) == kSmiTag) {
return Smi::Class();
}
- return raw_->ptr()->class_;
+ RawClass* result = raw_->ptr()->class_;
+ ASSERT(result->ptr()->index_ ==
+ RawObject::ClassTag::decode(raw_->ptr()->tags_));
siva 2012/04/02 18:29:21 Also assert class_table.At(RawObject::ClassTag::de
Ivan Posva 2012/04/29 21:08:25 Done.
+ return result;
}

Powered by Google App Engine
This is Rietveld 408576698