Fix duplicate check in DependentCode::Insert.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 14 Nov 2013 14:14:11 +0000 (14:14 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 14 Nov 2013 14:14:11 +0000 (14:14 +0000)
R=ulan@chromium.org
BUG=318454

Review URL: https://codereview.chromium.org/71653008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17747 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/objects.cc

index 3e1c251..8308146 100644 (file)
@@ -11648,11 +11648,9 @@ Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries,
   int start = starts.at(group);
   int end = starts.at(group + 1);
   int number_of_entries = starts.number_of_entries();
-  if (start < end && entries->object_at(end - 1) == *object) {
-    // Do not append the compilation info if it is already in the array.
-    // It is sufficient to just check only the last element because
-    // we process embedded maps of an optimized code in one batch.
-    return entries;
+  // Check for existing entry to avoid duplicates.
+  for (int i = start; i < end; i++) {
+    if (entries->object_at(i) == *object) return entries;
   }
   if (entries->length() < kCodesStartIndex + number_of_entries + 1) {
     Factory* factory = entries->GetIsolate()->factory();