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

Unified Diff: src/objects-debug.cc

Issue 218993005: Tighten object verification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « src/objects.h ('k') | src/spaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-debug.cc
diff --git a/src/objects-debug.cc b/src/objects-debug.cc
index ca025e6cf6bce56cce2b2a8bdd37bba926412af8..ba9ff65be0c4883b97685076fdeef82e9f528671 100644
--- a/src/objects-debug.cc
+++ b/src/objects-debug.cc
@@ -41,17 +41,22 @@ namespace internal {
void MaybeObject::Verify() {
Object* this_as_object;
if (ToObject(&this_as_object)) {
- if (this_as_object->IsSmi()) {
- Smi::cast(this_as_object)->SmiVerify();
- } else {
- HeapObject::cast(this_as_object)->HeapObjectVerify();
- }
+ this_as_object->ObjectVerify();
} else {
Failure::cast(this)->FailureVerify();
}
}
+void Object::ObjectVerify() {
+ if (IsSmi()) {
+ Smi::cast(this)->SmiVerify();
+ } else {
+ HeapObject::cast(this)->HeapObjectVerify();
+ }
+}
+
+
void Object::VerifyPointer(Object* p) {
if (p->IsHeapObject()) {
HeapObject::VerifyHeapPointer(p);
@@ -380,11 +385,7 @@ void AliasedArgumentsEntry::AliasedArgumentsEntryVerify() {
void FixedArray::FixedArrayVerify() {
for (int i = 0; i < length(); i++) {
Object* e = get(i);
- if (e->IsHeapObject()) {
- VerifyHeapPointer(e);
- } else {
- e->Verify();
- }
+ VerifyPointer(e);
}
}
@@ -626,7 +627,7 @@ void PropertyCell::PropertyCellVerify() {
void Code::CodeVerify() {
CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()),
kCodeAlignment));
- relocation_info()->Verify();
+ relocation_info()->ObjectVerify();
Address last_gc_pc = NULL;
for (RelocIterator it(this); !it.done(); it.next()) {
it.rinfo()->Verify();
@@ -811,7 +812,7 @@ void Foreign::ForeignVerify() {
void Box::BoxVerify() {
CHECK(IsBox());
- value()->Verify();
+ value()->ObjectVerify();
}
@@ -947,7 +948,7 @@ void Script::ScriptVerify() {
void JSFunctionResultCache::JSFunctionResultCacheVerify() {
- JSFunction::cast(get(kFactoryIndex))->Verify();
+ JSFunction::cast(get(kFactoryIndex))->ObjectVerify();
int size = Smi::cast(get(kCacheSizeIndex))->value();
CHECK(kEntriesIndex <= size);
@@ -962,18 +963,18 @@ void JSFunctionResultCache::JSFunctionResultCacheVerify() {
if (FLAG_enable_slow_asserts) {
for (int i = kEntriesIndex; i < size; i++) {
CHECK(!get(i)->IsTheHole());
- get(i)->Verify();
+ get(i)->ObjectVerify();
}
for (int i = size; i < length(); i++) {
CHECK(get(i)->IsTheHole());
- get(i)->Verify();
+ get(i)->ObjectVerify();
}
}
}
void NormalizedMapCache::NormalizedMapCacheVerify() {
- FixedArray::cast(this)->Verify();
+ FixedArray::cast(this)->FixedArrayVerify();
if (FLAG_enable_slow_asserts) {
for (int i = 0; i < length(); i++) {
Object* e = get(i);
« no previous file with comments | « src/objects.h ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698