OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1654 | 1654 |
1655 if (map->IsMarked() && map->attached_to_shared_function_info()) { | 1655 if (map->IsMarked() && map->attached_to_shared_function_info()) { |
1656 // This map is used for inobject slack tracking and has been detached | 1656 // This map is used for inobject slack tracking and has been detached |
1657 // from SharedFunctionInfo during the mark phase. | 1657 // from SharedFunctionInfo during the mark phase. |
1658 // Since it survived the GC, reattach it now. | 1658 // Since it survived the GC, reattach it now. |
1659 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map); | 1659 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map); |
1660 } | 1660 } |
1661 | 1661 |
1662 // Clear dead prototype transitions. | 1662 // Clear dead prototype transitions. |
1663 int number_of_transitions = map->NumberOfProtoTransitions(); | 1663 int number_of_transitions = map->NumberOfProtoTransitions(); |
1664 FixedArray* prototype_transitions = map->unchecked_prototype_transitions(); | 1664 if (number_of_transitions > 0) { |
1665 int new_number_of_transitions = 0; | 1665 FixedArray* prototype_transitions = map->unchecked_prototype_transitions() ; |
Søren Thygesen Gjesse
2011/07/13 13:13:16
Long line.
| |
1666 const int header = Map::kProtoTransitionHeaderSize; | 1666 int new_number_of_transitions = 0; |
1667 const int proto_offset = | 1667 const int header = Map::kProtoTransitionHeaderSize; |
1668 header + Map::kProtoTransitionPrototypeOffset; | 1668 const int proto_offset = |
1669 const int map_offset = header + Map::kProtoTransitionMapOffset; | 1669 header + Map::kProtoTransitionPrototypeOffset; |
1670 const int step = Map::kProtoTransitionElementsPerEntry; | 1670 const int map_offset = header + Map::kProtoTransitionMapOffset; |
1671 for (int i = 0; i < number_of_transitions; i++) { | 1671 const int step = Map::kProtoTransitionElementsPerEntry; |
1672 Object* prototype = prototype_transitions->get(proto_offset + i * step); | 1672 for (int i = 0; i < number_of_transitions; i++) { |
1673 Object* cached_map = prototype_transitions->get(map_offset + i * step); | 1673 Object* prototype = prototype_transitions->get(proto_offset + i * step); |
1674 if (HeapObject::cast(prototype)->IsMarked() && | 1674 Object* cached_map = prototype_transitions->get(map_offset + i * step); |
1675 HeapObject::cast(cached_map)->IsMarked()) { | 1675 if (HeapObject::cast(prototype)->IsMarked() && |
1676 if (new_number_of_transitions != i) { | 1676 HeapObject::cast(cached_map)->IsMarked()) { |
1677 prototype_transitions->set_unchecked( | 1677 if (new_number_of_transitions != i) { |
1678 heap_, | 1678 prototype_transitions->set_unchecked( |
1679 proto_offset + new_number_of_transitions * step, | 1679 heap_, |
1680 prototype, | 1680 proto_offset + new_number_of_transitions * step, |
1681 UPDATE_WRITE_BARRIER); | 1681 prototype, |
1682 prototype_transitions->set_unchecked( | 1682 UPDATE_WRITE_BARRIER); |
1683 heap_, | 1683 prototype_transitions->set_unchecked( |
1684 map_offset + new_number_of_transitions * step, | 1684 heap_, |
1685 cached_map, | 1685 map_offset + new_number_of_transitions * step, |
1686 SKIP_WRITE_BARRIER); | 1686 cached_map, |
1687 SKIP_WRITE_BARRIER); | |
1688 } | |
1689 new_number_of_transitions++; | |
1687 } | 1690 } |
1688 new_number_of_transitions++; | |
1689 } | 1691 } |
1690 | 1692 |
1691 // Fill slots that became free with undefined value. | 1693 // Fill slots that became free with undefined value. |
1692 Object* undefined = heap()->raw_unchecked_undefined_value(); | 1694 Object* undefined = heap()->raw_unchecked_undefined_value(); |
1693 for (int i = new_number_of_transitions * step; | 1695 for (int i = new_number_of_transitions * step; |
1694 i < number_of_transitions * step; | 1696 i < number_of_transitions * step; |
1695 i++) { | 1697 i++) { |
1696 prototype_transitions->set_unchecked(heap_, | 1698 prototype_transitions->set_unchecked(heap_, |
1697 header + i, | 1699 header + i, |
1698 undefined, | 1700 undefined, |
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3268 } | 3270 } |
3269 | 3271 |
3270 | 3272 |
3271 void MarkCompactCollector::Initialize() { | 3273 void MarkCompactCollector::Initialize() { |
3272 StaticPointersToNewGenUpdatingVisitor::Initialize(); | 3274 StaticPointersToNewGenUpdatingVisitor::Initialize(); |
3273 StaticMarkingVisitor::Initialize(); | 3275 StaticMarkingVisitor::Initialize(); |
3274 } | 3276 } |
3275 | 3277 |
3276 | 3278 |
3277 } } // namespace v8::internal | 3279 } } // namespace v8::internal |
OLD | NEW |