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

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, 8 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
« no previous file with comments | « vm/isolate.cc ('k') | vm/object.cc » ('j') | vm/raw_object.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object.h
===================================================================
--- vm/object.h (revision 6994)
+++ vm/object.h (working copy)
@@ -373,7 +373,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 {
uword vtable_addr = reinterpret_cast<uword>(this);
@@ -463,10 +463,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_; }
@@ -677,11 +682,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,
@@ -730,6 +730,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;
@@ -3937,7 +3943,12 @@
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_));
+ ASSERT(Isolate::Current()->class_table()->At(
+ RawObject::ClassTag::decode(raw_->ptr()->tags_)) == result);
+ return result;
}
« no previous file with comments | « vm/isolate.cc ('k') | vm/object.cc » ('j') | vm/raw_object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698