Revision: 9774
Author:   [email protected]
Date:     Tue Oct 25 06:27:46 2011
Log: Move some heap verification code in under the --verify-heap flag to speed
up debug mode tests.
Review URL: http://codereview.chromium.org/8381040
http://code.google.com/p/v8/source/detail?r=9774

Modified:
 /branches/bleeding_edge/src/heap-inl.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/incremental-marking.cc
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/spaces.cc
 /branches/bleeding_edge/src/spaces.h
 /branches/bleeding_edge/src/store-buffer.cc

=======================================
--- /branches/bleeding_edge/src/heap-inl.h      Thu Oct 13 04:50:00 2011
+++ /branches/bleeding_edge/src/heap-inl.h      Tue Oct 25 06:27:46 2011
@@ -590,7 +590,9 @@

 void ExternalStringTable::ShrinkNewStrings(int position) {
   new_space_strings_.Rewind(position);
-  Verify();
+  if (FLAG_verify_heap) {
+    Verify();
+  }
 }


=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Oct 24 01:59:34 2011
+++ /branches/bleeding_edge/src/heap.cc Tue Oct 25 06:27:46 2011
@@ -693,7 +693,9 @@
     PROFILE(isolate_, CodeMovingGCEvent());
   }

-  VerifySymbolTable();
+  if (FLAG_verify_heap) {
+    VerifySymbolTable();
+  }
   if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) {
     ASSERT(!allocation_allowed_);
     GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
@@ -789,7 +791,9 @@
     GCTracer::Scope scope(tracer, GCTracer::Scope::EXTERNAL);
     global_gc_epilogue_callback_();
   }
-  VerifySymbolTable();
+  if (FLAG_verify_heap) {
+    VerifySymbolTable();
+  }

   return next_gc_likely_to_collect_more;
 }
@@ -983,7 +987,7 @@

 void Heap::Scavenge() {
 #ifdef DEBUG
-  if (FLAG_enable_slow_asserts) VerifyNonPointerSpacePointers();
+  if (FLAG_verify_heap) VerifyNonPointerSpacePointers();
 #endif

   gc_state_ = SCAVENGE;
@@ -1112,7 +1116,9 @@

 void Heap::UpdateNewSpaceReferencesInExternalStringTable(
     ExternalStringTableUpdaterCallback updater_func) {
-  external_string_table_.Verify();
+  if (FLAG_verify_heap) {
+    external_string_table_.Verify();
+  }

   if (external_string_table_.new_space_strings_.is_empty()) return;

@@ -2910,7 +2916,9 @@

   ASSERT(buffer->IsFlat());
 #if DEBUG
-  buffer->StringVerify();
+  if (FLAG_verify_heap) {
+    buffer->StringVerify();
+  }
 #endif

   Object* result;
@@ -3156,7 +3164,9 @@
   code->CopyFrom(desc);

 #ifdef DEBUG
-  code->Verify();
+  if (FLAG_verify_heap) {
+    code->Verify();
+  }
 #endif
   return code;
 }
@@ -3236,7 +3246,9 @@
   new_code->Relocate(new_addr - old_addr);

 #ifdef DEBUG
-  code->Verify();
+  if (FLAG_verify_heap) {
+    code->Verify();
+  }
 #endif
   return new_code;
 }
@@ -6345,7 +6357,9 @@
     old_space_strings_[last++] = old_space_strings_[i];
   }
   old_space_strings_.Rewind(last);
-  Verify();
+  if (FLAG_verify_heap) {
+    Verify();
+  }
 }


=======================================
--- /branches/bleeding_edge/src/incremental-marking.cc Tue Oct 25 05:13:06 2011 +++ /branches/bleeding_edge/src/incremental-marking.cc Tue Oct 25 06:27:46 2011
@@ -473,7 +473,7 @@

 #ifdef DEBUG
   // Marking bits are cleared by the sweeper.
-  if (FLAG_enable_slow_asserts) {
+  if (FLAG_verify_heap) {
     heap_->mark_compact_collector()->VerifyMarkbitsAreClean();
   }
 #endif
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Mon Oct 24 00:47:22 2011
+++ /branches/bleeding_edge/src/objects-inl.h   Tue Oct 25 06:27:46 2011
@@ -765,7 +765,10 @@
     return false;
   }
 #ifdef DEBUG
- reinterpret_cast<JSFunctionResultCache*>(this)->JSFunctionResultCacheVerify();
+  if (FLAG_verify_heap) {
+    reinterpret_cast<JSFunctionResultCache*>(this)->
+        JSFunctionResultCacheVerify();
+  }
 #endif
   return true;
 }
@@ -777,7 +780,9 @@
     return false;
   }
 #ifdef DEBUG
-  reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify();
+  if (FLAG_verify_heap) {
+ reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify();
+  }
 #endif
   return true;
 }
=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Oct 25 02:24:49 2011
+++ /branches/bleeding_edge/src/objects.cc      Tue Oct 25 06:27:46 2011
@@ -3231,7 +3231,9 @@
   if (result->IsMap() &&
       Map::cast(result)->EquivalentToForNormalization(fast, mode)) {
 #ifdef DEBUG
-    Map::cast(result)->SharedMapVerify();
+    if (FLAG_verify_heap) {
+      Map::cast(result)->SharedMapVerify();
+    }
     if (FLAG_enable_slow_asserts) {
// The cached map should match newly created normalized map bit-by-bit.
       Object* fresh;
@@ -4727,7 +4729,7 @@
   Map::cast(result)->set_is_shared(sharing == SHARED_NORMALIZED_MAP);

 #ifdef DEBUG
-  if (Map::cast(result)->is_shared()) {
+  if (FLAG_verify_heap && Map::cast(result)->is_shared()) {
     Map::cast(result)->SharedMapVerify();
   }
 #endif
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Tue Oct 25 01:33:08 2011
+++ /branches/bleeding_edge/src/runtime.cc      Tue Oct 25 06:27:46 2011
@@ -13199,7 +13199,9 @@
   }

 #ifdef DEBUG
-  cache_handle->JSFunctionResultCacheVerify();
+  if (FLAG_verify_heap) {
+    cache_handle->JSFunctionResultCacheVerify();
+  }
 #endif

   // Function invocation may have cleared the cache.  Reread all the data.
@@ -13228,7 +13230,9 @@
   cache_handle->set_finger_index(index);

 #ifdef DEBUG
-  cache_handle->JSFunctionResultCacheVerify();
+  if (FLAG_verify_heap) {
+    cache_handle->JSFunctionResultCacheVerify();
+  }
 #endif

   return *value;
=======================================
--- /branches/bleeding_edge/src/spaces.cc       Wed Oct 19 03:15:09 2011
+++ /branches/bleeding_edge/src/spaces.cc       Tue Oct 25 06:27:46 2011
@@ -95,10 +95,6 @@
   cur_end_ = end;
   page_mode_ = mode;
   size_func_ = size_f;
-
-#ifdef DEBUG
-  Verify();
-#endif
 }


@@ -121,13 +117,6 @@
   ASSERT(cur_page->WasSweptPrecisely());
   return true;
 }
-
-
-#ifdef DEBUG
-void HeapObjectIterator::Verify() {
-  // TODO(gc): We should do something here.
-}
-#endif


// -----------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/spaces.h        Wed Oct 19 03:15:09 2011
+++ /branches/bleeding_edge/src/spaces.h        Tue Oct 25 06:27:46 2011
@@ -1132,11 +1132,6 @@
                          Address end,
                          PageMode mode,
                          HeapObjectCallback size_func);
-
-#ifdef DEBUG
-  // Verifies whether fields have valid values.
-  void Verify();
-#endif
 };


=======================================
--- /branches/bleeding_edge/src/store-buffer.cc Thu Oct 13 05:44:52 2011
+++ /branches/bleeding_edge/src/store-buffer.cc Tue Oct 25 06:27:46 2011
@@ -390,20 +390,20 @@

 void StoreBuffer::Verify() {
 #ifdef DEBUG
-  if (FLAG_enable_slow_asserts || FLAG_verify_heap) {
-    VerifyPointers(heap_->old_pointer_space(),
-                   &StoreBuffer::FindPointersToNewSpaceInRegion);
-    VerifyPointers(heap_->map_space(),
-                   &StoreBuffer::FindPointersToNewSpaceInMapsRegion);
-    VerifyPointers(heap_->lo_space());
-  }
+  VerifyPointers(heap_->old_pointer_space(),
+                 &StoreBuffer::FindPointersToNewSpaceInRegion);
+  VerifyPointers(heap_->map_space(),
+                 &StoreBuffer::FindPointersToNewSpaceInMapsRegion);
+  VerifyPointers(heap_->lo_space());
 #endif
 }


 void StoreBuffer::GCEpilogue() {
   during_gc_ = false;
-  Verify();
+  if (FLAG_verify_heap) {
+    Verify();
+  }
 }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to