Reviewers: danno,

Message:
PTAL.

Description:
Extending map verification to also verify LastAdded/DescriptorArray consistency.

Removed ASSERT now subsumed by extended map verification.


Please review this at https://chromiumcodereview.appspot.com/10827037/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/heap.cc
  M src/objects-debug.cc
  M src/objects.cc


Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 69529ad6de97de7d6d3912603b44c372280a8c59..8e64f9e39cc5d02ee46e4b4ed77423c360594754 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -4159,8 +4159,6 @@ MaybeObject* Heap::AllocateGlobalObject(JSFunction* constructor) {
   MaybeObject* maybe_map = map->CopyDropDescriptors();
   if (!maybe_map->To(&new_map)) return maybe_map;

-  ASSERT(new_map->LastAdded() == Map::kNoneAdded);
-
   // Set up the global object as a normalized object.
   global->set_map(new_map);
   global->set_properties(dictionary);
Index: src/objects-debug.cc
diff --git a/src/objects-debug.cc b/src/objects-debug.cc
index 3047326e2ab195789d438c7e7efc15802cdebbe7..c738d905bc414330cff89f8c33873ffe2cc929c3 100644
--- a/src/objects-debug.cc
+++ b/src/objects-debug.cc
@@ -302,6 +302,12 @@ void Map::MapVerify() {
           instance_size() < HEAP->Capacity()));
   VerifyHeapPointer(prototype());
   VerifyHeapPointer(instance_descriptors());
+  if (instance_descriptors()->number_of_descriptors() == 0) {
+    ASSERT(LastAdded() == kNoneAdded);
+  } else {
+    ASSERT(instance_descriptors()->GetDetails(LastAdded()).index() ==
+           NumberOfSetDescriptors());
+  }
   SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates());
   if (HasTransitionArray()) {
     SLOW_ASSERT(transitions()->IsSortedNoDuplicates());
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 57f416514333a65d65752c4ea1a8698fd8da3301..5b442ed06cfc386c44173778eaa80b4b5a326a9a 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -4872,7 +4872,7 @@ MaybeObject* Map::CopyReplaceDescriptors(DescriptorArray* descriptors,
   if (!maybe_result->To(&result)) return maybe_result;

   if (last_added == kNoneAdded) {
-    ASSERT(descriptors->IsEmpty());
+    ASSERT(descriptors->number_of_descriptors() == 0);
   } else {
     ASSERT(descriptors->GetDetails(last_added).index() ==
            descriptors->number_of_descriptors());


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

Reply via email to