OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 template <class T> | 1865 template <class T> |
1866 void Marker<T>::MarkDescriptorArray(DescriptorArray* descriptors) { | 1866 void Marker<T>::MarkDescriptorArray(DescriptorArray* descriptors) { |
1867 // Empty descriptor array is marked as a root before any maps are marked. | 1867 // Empty descriptor array is marked as a root before any maps are marked. |
1868 ASSERT(descriptors != descriptors->GetHeap()->empty_descriptor_array()); | 1868 ASSERT(descriptors != descriptors->GetHeap()->empty_descriptor_array()); |
1869 | 1869 |
1870 // The DescriptorArray contains a pointer to its contents array, but the | 1870 // The DescriptorArray contains a pointer to its contents array, but the |
1871 // contents array will be marked black and hence not be visited again. | 1871 // contents array will be marked black and hence not be visited again. |
1872 if (!base_marker()->MarkObjectAndPush(descriptors)) return; | 1872 if (!base_marker()->MarkObjectAndPush(descriptors)) return; |
1873 FixedArray* contents = FixedArray::cast( | 1873 FixedArray* contents = FixedArray::cast( |
1874 descriptors->get(DescriptorArray::kContentArrayIndex)); | 1874 descriptors->get(DescriptorArray::kContentArrayIndex)); |
1875 ASSERT(contents->length() >= 2); | |
1876 ASSERT(Marking::IsWhite(Marking::MarkBitFrom(contents))); | 1875 ASSERT(Marking::IsWhite(Marking::MarkBitFrom(contents))); |
1877 base_marker()->MarkObjectWithoutPush(contents); | 1876 base_marker()->MarkObjectWithoutPush(contents); |
1878 | 1877 |
1879 // Contents contains (value, details) pairs. If the descriptor contains a | 1878 // If the descriptor contains a transition (value is a Map), we don't mark the |
1880 // transition (value is a Map), we don't mark the value as live. It might | 1879 // value as live. It might be set to the NULL_DESCRIPTOR in |
1881 // be set to the NULL_DESCRIPTOR in ClearNonLiveTransitions later. | 1880 // ClearNonLiveTransitions later. |
1882 for (int i = 0; i < contents->length(); i += 2) { | 1881 for (int i = 0; i < descriptors->number_of_descriptors(); ++i) { |
1883 PropertyDetails details(Smi::cast(contents->get(i + 1))); | 1882 PropertyDetails details(descriptors->GetDetails(i)); |
| 1883 Object** slot = descriptors->GetValueSlot(i); |
1884 | 1884 |
1885 Object** slot = contents->data_start() + i; | |
1886 if (!(*slot)->IsHeapObject()) continue; | 1885 if (!(*slot)->IsHeapObject()) continue; |
1887 HeapObject* value = HeapObject::cast(*slot); | 1886 HeapObject* value = HeapObject::cast(*slot); |
1888 | 1887 |
1889 mark_compact_collector()->RecordSlot(slot, slot, *slot); | 1888 mark_compact_collector()->RecordSlot(slot, slot, *slot); |
1890 | 1889 |
1891 switch (details.type()) { | 1890 switch (details.type()) { |
1892 case NORMAL: | 1891 case NORMAL: |
1893 case FIELD: | 1892 case FIELD: |
1894 case CONSTANT_FUNCTION: | 1893 case CONSTANT_FUNCTION: |
1895 case HANDLER: | 1894 case HANDLER: |
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4102 while (buffer != NULL) { | 4101 while (buffer != NULL) { |
4103 SlotsBuffer* next_buffer = buffer->next(); | 4102 SlotsBuffer* next_buffer = buffer->next(); |
4104 DeallocateBuffer(buffer); | 4103 DeallocateBuffer(buffer); |
4105 buffer = next_buffer; | 4104 buffer = next_buffer; |
4106 } | 4105 } |
4107 *buffer_address = NULL; | 4106 *buffer_address = NULL; |
4108 } | 4107 } |
4109 | 4108 |
4110 | 4109 |
4111 } } // namespace v8::internal | 4110 } } // namespace v8::internal |
OLD | NEW |