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

Unified Diff: vm/raw_object.cc

Issue 9072011: - Add a size field to the header. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 8 years, 12 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/raw_object.h ('k') | vm/stub_code_ia32.cc » ('j') | vm/stub_code_x64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/raw_object.cc
===================================================================
--- vm/raw_object.cc (revision 2918)
+++ vm/raw_object.cc (working copy)
@@ -13,6 +13,11 @@
namespace dart {
void RawObject::Validate() const {
+ if (Object::null_class_ == reinterpret_cast<RawClass*>(kHeapObjectTag)) {
+ // Validation relies on properly initialized class classes. Skip if the
+ // VM is still being initialized.
+ return;
+ }
// All Smi values are valid.
if (!IsHeapObject()) {
return;
@@ -26,11 +31,11 @@
// Validate that the tags_ field is sensible.
intptr_t tags = ptr()->tags_;
- ASSERT((tags & 0xfffffff0) == 0);
+ ASSERT((tags & 0xffff00f0) == 0);
}
-intptr_t RawObject::Size() const {
+intptr_t RawObject::SizeFromClass() const {
NoHandleScope no_handles(Isolate::Current());
// Only reasonable to be called on heap objects.
@@ -147,6 +152,7 @@
break;
}
case kFreeListElement: {
+ ASSERT(FreeBit::decode(ptr()->tags_));
uword addr = RawObject::ToAddr(const_cast<RawObject*>(this));
FreeListElement* element = reinterpret_cast<FreeListElement*>(addr);
instance_size = element->Size();
@@ -158,6 +164,10 @@
}
}
ASSERT(instance_size != 0);
+ intptr_t tags = ptr()->tags_;
+ ASSERT((instance_size == (SizeTag::decode(tags))) ||
+ (SizeTag::decode(tags) == 0) ||
+ FreeBit::decode(tags));
return instance_size;
}
@@ -186,6 +196,7 @@
CLASS_LIST_NO_OBJECT(RAW_VISITPOINTERS)
#undef RAW_VISITPOINTERS
case kFreeListElement: {
+ ASSERT(FreeBit::decode(ptr()->tags_));
// Nothing to visit for free list elements.
uword addr = RawObject::ToAddr(this);
FreeListElement* element = reinterpret_cast<FreeListElement*>(addr);
@@ -199,6 +210,7 @@
}
ASSERT(size != 0);
+ ASSERT(size == Size());
return size;
}
« no previous file with comments | « vm/raw_object.h ('k') | vm/stub_code_ia32.cc » ('j') | vm/stub_code_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698