Revision: 20382
Author:   [email protected]
Date:     Tue Apr  1 08:57:48 2014 UTC
Log:      Tighten object verification.

Often, when we call MaybeObject::Verify, what we want is Object::ObjectVerify.

[email protected]

Review URL: https://codereview.chromium.org/218993005
http://code.google.com/p/v8/source/detail?r=20382

Modified:
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/bootstrapper.cc
 /branches/bleeding_edge/src/objects-debug.cc
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/spaces.cc

=======================================
--- /branches/bleeding_edge/src/api.cc  Mon Mar 31 16:21:20 2014 UTC
+++ /branches/bleeding_edge/src/api.cc  Tue Apr  1 08:57:48 2014 UTC
@@ -533,7 +533,7 @@
   LOG_API(isolate, "Persistent::New");
   i::Handle<i::Object> result = isolate->global_handles()->Create(*obj);
 #ifdef DEBUG
-  (*obj)->Verify();
+  (*obj)->ObjectVerify();
 #endif  // DEBUG
   return result.location();
 }
@@ -542,7 +542,7 @@
 i::Object** V8::CopyPersistent(i::Object** obj) {
   i::Handle<i::Object> result = i::GlobalHandles::CopyGlobal(obj);
 #ifdef DEBUG
-  (*obj)->Verify();
+  (*obj)->ObjectVerify();
 #endif  // DEBUG
   return result.location();
 }
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Mon Mar 31 12:40:32 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Tue Apr  1 08:57:48 2014 UTC
@@ -2000,7 +2000,7 @@
   }

 #ifdef VERIFY_HEAP
-  builtins->Verify();
+  builtins->ObjectVerify();
 #endif

   return true;
=======================================
--- /branches/bleeding_edge/src/objects-debug.cc Wed Mar 26 12:50:13 2014 UTC +++ /branches/bleeding_edge/src/objects-debug.cc Tue Apr 1 08:57:48 2014 UTC
@@ -41,15 +41,20 @@
 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) {
@@ -380,11 +385,7 @@
 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 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 Box::BoxVerify() {
   CHECK(IsBox());
-  value()->Verify();
+  value()->ObjectVerify();
 }


@@ -947,7 +948,7 @@


 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 @@
   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);
=======================================
--- /branches/bleeding_edge/src/objects.h       Mon Mar 31 15:30:13 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Tue Apr  1 08:57:48 2014 UTC
@@ -1629,6 +1629,7 @@
   // < the length of the string.  Used to implement [] on strings.
   inline bool IsStringObjectWithCharacterAt(uint32_t index);

+  DECLARE_VERIFIER(Object)
 #ifdef VERIFY_HEAP
   // Verify a pointer is a valid object pointer.
   static void VerifyPointer(Object* p);
=======================================
--- /branches/bleeding_edge/src/spaces.cc       Fri Mar 28 15:25:24 2014 UTC
+++ /branches/bleeding_edge/src/spaces.cc       Tue Apr  1 08:57:48 2014 UTC
@@ -1195,7 +1195,7 @@
       VerifyObject(object);

       // The object itself should look OK.
-      object->Verify();
+      object->ObjectVerify();

       // All the interior pointers should be contained in the heap.
       int size = object->Size();
@@ -1478,7 +1478,7 @@
       CHECK(!object->IsCode());

       // The object itself should look OK.
-      object->Verify();
+      object->ObjectVerify();

       // All the interior pointers should be contained in the heap.
       VerifyPointersVisitor visitor;
@@ -3119,7 +3119,7 @@
            object->IsFixedDoubleArray() || object->IsByteArray());

     // The object itself should look OK.
-    object->Verify();
+    object->ObjectVerify();

     // Byte arrays and strings don't have interior pointers.
     if (object->IsCode()) {

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to