Reviewers: Hannes Payer,

Description:
Add sanity check to CodeFlusher::AddCandidate.

R=hpa...@chromium.org
BUG=chromium:169209


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

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

Affected files:
  M src/mark-compact.h
  M src/mark-compact.cc


Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 2c6d9d1c93687b96bfa4144638374982289c199d..9cfe5e04821ae38592dfa77edcc03e48fe787b69 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -933,6 +933,16 @@ void CodeFlusher::ProcessSharedFunctionInfoCandidates() {
 }


+bool CodeFlusher::ContainsCandidate(SharedFunctionInfo* shared_info) {
+  SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
+  while (candidate != NULL) {
+    if (candidate == shared_info) return true;
+    candidate = GetNextCandidate(candidate);
+  }
+  return false;
+}
+
+
 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) {
   // The function is no longer a candidate, make sure it gets visited
   // again so that previous flushing decisions are revisited.
Index: src/mark-compact.h
diff --git a/src/mark-compact.h b/src/mark-compact.h
index 8821c3df30a3b00d3b9139410b7022547604fbd4..b34be6b91daabf696440b607e23a8c7532859130 100644
--- a/src/mark-compact.h
+++ b/src/mark-compact.h
@@ -423,6 +423,10 @@ class CodeFlusher {
     if (GetNextCandidate(shared_info) == NULL) {
       SetNextCandidate(shared_info, shared_function_info_candidates_head_);
       shared_function_info_candidates_head_ = shared_info;
+    } else {
+      // TODO(mstarzinger): Active in release mode to flush out problems.
+      // Should be turned back into an ASSERT or removed completely.
+      CHECK(ContainsCandidate(shared_info));
     }
   }

@@ -434,6 +438,8 @@ class CodeFlusher {
     }
   }

+  bool ContainsCandidate(SharedFunctionInfo* shared_info);
+
   void EvictCandidate(SharedFunctionInfo* shared_info);
   void EvictCandidate(JSFunction* function);



--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to