Reviewers: Yang,

Message:
PTAL

Description:
Fix clearing of dependent codes.

When clearing the array we need to copy live compilation infos and record slots.

BUG=248076
[email protected]

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

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

Affected files:
  M src/mark-compact.cc


Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 99c5b4864d3ed94cb37e5a113994bd35e4559acd..0835d36555754744ea489ef3b50e8a0cb10f47b0 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -2481,7 +2481,9 @@ void MarkCompactCollector::ClearAndDeoptimizeDependentCode(Map* map) {
   int number_of_entries = starts.number_of_entries();
   if (number_of_entries == 0) return;
   for (int i = 0; i < number_of_entries; i++) {
-    if (!entries->is_code_at(i)) continue;
+    // If the entry is compilation info then the map must be alive,
+    // and ClearAndDeoptimizeDependentCode shouldn't be called.
+    ASSERT(entries->is_code_at(i));
     Code* code = entries->code_at(i);
     if (IsMarked(code) && !code->marked_for_deoptimization()) {
       code->set_marked_for_deoptimization(true);
@@ -2503,16 +2505,17 @@ void MarkCompactCollector::ClearNonLiveDependentCode(Map* map) {
   for (int g = 0; g < DependentCode::kGroupCount; g++) {
     int group_number_of_entries = 0;
     for (int i = starts.at(g); i < starts.at(g + 1); i++) {
-      if (!entries->is_code_at(i)) continue;
-      Code* code = entries->code_at(i);
-      if (IsMarked(code) && !code->marked_for_deoptimization()) {
+      Object* obj = entries->object_at(i);
+      ASSERT(obj->IsCode() || IsMarked(obj));
+      if (IsMarked(obj) &&
+ (!obj->IsCode() | | !Code::cast(obj)->marked_for_deoptimization())) {
         if (new_number_of_entries + group_number_of_entries != i) {
           entries->set_object_at(
-              new_number_of_entries + group_number_of_entries, code);
+              new_number_of_entries + group_number_of_entries, obj);
         }
         Object** slot = entries->slot_at(new_number_of_entries +
                                          group_number_of_entries);
-        RecordSlot(slot, slot, code);
+        RecordSlot(slot, slot, obj);
         group_number_of_entries++;
       }
     }


--
--
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