Reviewers: ulan,

Description:
Add verification code to dependent code.

[email protected]
BUG=

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

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

Affected files:
  M src/compiler.cc
  M src/objects.h
  M src/objects.cc


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index c6b911feecc8e0d48972e9a57fd046daf84e1421..0819aa474e3bfb9661aa2cb6b806784ea84c7af9 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -161,8 +161,29 @@ void CompilationInfo::RollbackDependentMaps() {
       group_maps->at(j)->dependent_code()->RemoveCompilationInfo(
           static_cast<DependentCode::DependencyGroup>(i), this);
     }
+#ifndef DEBUG
     dependent_maps_[i] = NULL;  // Zone-allocated, no need to delete.
+#endif
+  }
+
+#ifdef DEBUG
+  // Verify that with sequential recompilation, we don't leave any
+  // compilation wrappers behind.
+  if (!FLAG_parallel_recompilation) {
+    for (int i = 0; i < DependentCode::kGroupCount; i++) {
+      ZoneList<Handle<Map> >* group_maps = dependent_maps_[i];
+      if (group_maps == NULL) continue;
+      for (int j = 0; j < group_maps->length(); j++) {
+ DependentCode* dependent_code = group_maps->at(j)->dependent_code();
+        DependentCode::GroupStartIndexes starts(dependent_code);
+        for (int i = 0; i < starts.number_of_entries(); i++) {
+          ASSERT(dependent_code->object_at(i)->IsCode());
+        }
+      }
+      dependent_maps_[i] = NULL;  // Zone-allocated, no need to delete.
+    }
   }
+#endif  // DEBUG
 }


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index fc42fc7ecc43c263aef2dd187b5ef21dae588f73..b89e92e4ff42b57eba9a5a56c4e97f8c71daa780 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11229,7 +11229,7 @@ void DependentCode::RemoveCompilationInfo(DependentCode::DependencyGroup group,

 bool DependentCode::Contains(DependencyGroup group, Code* code) {
   GroupStartIndexes starts(this);
-  int number_of_entries = starts.number_of_code_entries();
+  int number_of_entries = starts.number_of_entries();
   for (int i = 0; i < number_of_entries; i++) {
     if (object_at(i) == code) return true;
   }
@@ -11252,7 +11252,7 @@ void DependentCode::DeoptimizeDependentCodeGroup(
   DependentCode::GroupStartIndexes starts(this);
   int start = starts.at(group);
   int end = starts.at(group + 1);
-  int code_entries = starts.number_of_code_entries();
+  int code_entries = starts.number_of_entries();
   if (start == end) return;
   for (int i = start; i < end; i++) {
     if (is_code_at(i)) {
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 756631068e719d0345e1889f9b2f63ff367237e8..6c3b732bdd07daacdbeb621cde254de679d2b54a 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -5029,9 +5029,6 @@ class DependentCode: public FixedArray {
     void Recompute(DependentCode* entries);
     int at(int i) { return start_indexes_[i]; }
     int number_of_entries() { return start_indexes_[kGroupCount]; }
-    int number_of_code_entries() {
-      return start_indexes_[kGroupCount];
-    }
    private:
     int start_indexes_[kGroupCount + 1];
   };


--
--
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/groups/opt_out.


Reply via email to