| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 557 |
| 558 // There may be overflowed objects in the heap. Visit them now. | 558 // There may be overflowed objects in the heap. Visit them now. |
| 559 while (marking_stack.overflowed()) { | 559 while (marking_stack.overflowed()) { |
| 560 RefillMarkingStack(); | 560 RefillMarkingStack(); |
| 561 EmptyMarkingStack(visitor->stack_visitor()); | 561 EmptyMarkingStack(visitor->stack_visitor()); |
| 562 } | 562 } |
| 563 } | 563 } |
| 564 | 564 |
| 565 | 565 |
| 566 void MarkCompactCollector::MarkObjectGroups() { | 566 void MarkCompactCollector::MarkObjectGroups() { |
| 567 List<ObjectGroup*>& object_groups = GlobalHandles::ObjectGroups(); | 567 List<ObjectGroup*>* object_groups = GlobalHandles::ObjectGroups(); |
| 568 | 568 |
| 569 for (int i = 0; i < object_groups.length(); i++) { | 569 for (int i = 0; i < object_groups->length(); i++) { |
| 570 ObjectGroup* entry = object_groups[i]; | 570 ObjectGroup* entry = object_groups->at(i); |
| 571 if (entry == NULL) continue; | 571 if (entry == NULL) continue; |
| 572 | 572 |
| 573 List<Object**>& objects = entry->objects_; | 573 List<Object**>& objects = entry->objects_; |
| 574 bool group_marked = false; | 574 bool group_marked = false; |
| 575 for (int j = 0; j < objects.length(); j++) { | 575 for (int j = 0; j < objects.length(); j++) { |
| 576 Object* object = *objects[j]; | 576 Object* object = *objects[j]; |
| 577 if (object->IsHeapObject() && HeapObject::cast(object)->IsMarked()) { | 577 if (object->IsHeapObject() && HeapObject::cast(object)->IsMarked()) { |
| 578 group_marked = true; | 578 group_marked = true; |
| 579 break; | 579 break; |
| 580 } | 580 } |
| 581 } | 581 } |
| 582 | 582 |
| 583 if (!group_marked) continue; | 583 if (!group_marked) continue; |
| 584 | 584 |
| 585 // An object in the group is marked, so mark as gray all white heap | 585 // An object in the group is marked, so mark as gray all white heap |
| 586 // objects in the group. | 586 // objects in the group. |
| 587 for (int j = 0; j < objects.length(); ++j) { | 587 for (int j = 0; j < objects.length(); ++j) { |
| 588 if ((*objects[j])->IsHeapObject()) { | 588 if ((*objects[j])->IsHeapObject()) { |
| 589 MarkObject(HeapObject::cast(*objects[j])); | 589 MarkObject(HeapObject::cast(*objects[j])); |
| 590 } | 590 } |
| 591 } | 591 } |
| 592 // Once the entire group has been colored gray, set the object group | 592 // Once the entire group has been colored gray, set the object group |
| 593 // to NULL so it won't be processed again. | 593 // to NULL so it won't be processed again. |
| 594 delete object_groups[i]; | 594 delete object_groups->at(i); |
| 595 object_groups[i] = NULL; | 595 object_groups->at(i) = NULL; |
| 596 } | 596 } |
| 597 } | 597 } |
| 598 | 598 |
| 599 | 599 |
| 600 // Mark all objects reachable from the objects on the marking stack. | 600 // Mark all objects reachable from the objects on the marking stack. |
| 601 // Before: the marking stack contains zero or more heap object pointers. | 601 // Before: the marking stack contains zero or more heap object pointers. |
| 602 // After: the marking stack is empty, and all objects reachable from the | 602 // After: the marking stack is empty, and all objects reachable from the |
| 603 // marking stack have been marked, or are overflowed in the heap. | 603 // marking stack have been marked, or are overflowed in the heap. |
| 604 void MarkCompactCollector::EmptyMarkingStack(MarkingVisitor* visitor) { | 604 void MarkCompactCollector::EmptyMarkingStack(MarkingVisitor* visitor) { |
| 605 while (!marking_stack.is_empty()) { | 605 while (!marking_stack.is_empty()) { |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 | 1887 |
| 1888 void MarkCompactCollector::RebuildRSets() { | 1888 void MarkCompactCollector::RebuildRSets() { |
| 1889 #ifdef DEBUG | 1889 #ifdef DEBUG |
| 1890 ASSERT(state_ == RELOCATE_OBJECTS); | 1890 ASSERT(state_ == RELOCATE_OBJECTS); |
| 1891 state_ = REBUILD_RSETS; | 1891 state_ = REBUILD_RSETS; |
| 1892 #endif | 1892 #endif |
| 1893 Heap::RebuildRSets(); | 1893 Heap::RebuildRSets(); |
| 1894 } | 1894 } |
| 1895 | 1895 |
| 1896 } } // namespace v8::internal | 1896 } } // namespace v8::internal |
| OLD | NEW |