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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 // Mark the Object* fields of the Map. | 464 // Mark the Object* fields of the Map. |
465 // Since the descriptor array has been marked already, it is fine | 465 // Since the descriptor array has been marked already, it is fine |
466 // that one of these fields contains a pointer to it. | 466 // that one of these fields contains a pointer to it. |
467 MarkingVisitor visitor; // Has no state or contents. | 467 MarkingVisitor visitor; // Has no state or contents. |
468 visitor.VisitPointers(HeapObject::RawField(map, Map::kPrototypeOffset), | 468 visitor.VisitPointers(HeapObject::RawField(map, Map::kPrototypeOffset), |
469 HeapObject::RawField(map, Map::kSize)); | 469 HeapObject::RawField(map, Map::kSize)); |
470 } | 470 } |
471 | 471 |
472 | 472 |
473 void MarkCompactCollector::MarkDescriptorArray( | 473 void MarkCompactCollector::MarkDescriptorArray( |
474 DescriptorArray *descriptors) { | 474 DescriptorArray* descriptors) { |
475 if (descriptors->IsMarked()) return; | 475 if (descriptors->IsMarked()) return; |
476 // Empty descriptor array is marked as a root before any maps are marked. | 476 // Empty descriptor array is marked as a root before any maps are marked. |
477 ASSERT(descriptors != Heap::empty_descriptor_array()); | 477 ASSERT(descriptors != Heap::empty_descriptor_array()); |
478 SetMark(descriptors); | 478 SetMark(descriptors); |
479 | 479 |
480 FixedArray* contents = reinterpret_cast<FixedArray*>( | 480 FixedArray* contents = reinterpret_cast<FixedArray*>( |
481 descriptors->get(DescriptorArray::kContentArrayIndex)); | 481 descriptors->get(DescriptorArray::kContentArrayIndex)); |
482 ASSERT(contents->IsHeapObject()); | 482 ASSERT(contents->IsHeapObject()); |
483 ASSERT(!contents->IsMarked()); | 483 ASSERT(!contents->IsMarked()); |
484 ASSERT(contents->IsFixedArray()); | 484 ASSERT(contents->IsFixedArray()); |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 while (SafeIsMap(current)) { | 864 while (SafeIsMap(current)) { |
865 current = reinterpret_cast<Map*>(current->prototype()); | 865 current = reinterpret_cast<Map*>(current->prototype()); |
866 ASSERT(current->IsHeapObject()); | 866 ASSERT(current->IsHeapObject()); |
867 } | 867 } |
868 Object* real_prototype = current; | 868 Object* real_prototype = current; |
869 | 869 |
870 // Follow back pointers, setting them to prototype, | 870 // Follow back pointers, setting them to prototype, |
871 // clearing map transitions when necessary. | 871 // clearing map transitions when necessary. |
872 current = map; | 872 current = map; |
873 bool on_dead_path = !current->IsMarked(); | 873 bool on_dead_path = !current->IsMarked(); |
874 Object *next; | 874 Object* next; |
875 while (SafeIsMap(current)) { | 875 while (SafeIsMap(current)) { |
876 next = current->prototype(); | 876 next = current->prototype(); |
877 // There should never be a dead map above a live map. | 877 // There should never be a dead map above a live map. |
878 ASSERT(on_dead_path || current->IsMarked()); | 878 ASSERT(on_dead_path || current->IsMarked()); |
879 | 879 |
880 // A live map above a dead map indicates a dead transition. | 880 // A live map above a dead map indicates a dead transition. |
881 // This test will always be false on the first iteration. | 881 // This test will always be false on the first iteration. |
882 if (on_dead_path && current->IsMarked()) { | 882 if (on_dead_path && current->IsMarked()) { |
883 on_dead_path = false; | 883 on_dead_path = false; |
884 current->ClearNonLiveTransitions(real_prototype); | 884 current->ClearNonLiveTransitions(real_prototype); |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 | 1794 |
1795 void MarkCompactCollector::RebuildRSets() { | 1795 void MarkCompactCollector::RebuildRSets() { |
1796 #ifdef DEBUG | 1796 #ifdef DEBUG |
1797 ASSERT(state_ == RELOCATE_OBJECTS); | 1797 ASSERT(state_ == RELOCATE_OBJECTS); |
1798 state_ = REBUILD_RSETS; | 1798 state_ = REBUILD_RSETS; |
1799 #endif | 1799 #endif |
1800 Heap::RebuildRSets(); | 1800 Heap::RebuildRSets(); |
1801 } | 1801 } |
1802 | 1802 |
1803 } } // namespace v8::internal | 1803 } } // namespace v8::internal |
OLD | NEW |