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 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1860 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(obj)); | 1860 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(obj)); |
1861 } | 1861 } |
1862 } | 1862 } |
1863 | 1863 |
1864 | 1864 |
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 if (!base_marker()->MarkObjectWithoutPush(descriptors)) return; |
1871 // contents array will be marked black and hence not be visited again. | 1871 Object** descriptor_start = descriptors->data_start(); |
1872 if (!base_marker()->MarkObjectAndPush(descriptors)) return; | |
1873 FixedArray* contents = FixedArray::cast( | |
1874 descriptors->get(DescriptorArray::kContentArrayIndex)); | |
1875 ASSERT(contents->length() >= 2); | |
1876 ASSERT(Marking::IsWhite(Marking::MarkBitFrom(contents))); | |
1877 base_marker()->MarkObjectWithoutPush(contents); | |
1878 | 1872 |
1879 // Contents contains (value, details) pairs. If the descriptor contains a | 1873 if (descriptors->HasEnumCache()) { |
1880 // transition (value is a Map), we don't mark the value as live. It might | 1874 Object** enum_cache_slot = descriptors->GetEnumCacheSlot(); |
1881 // be set to the NULL_DESCRIPTOR in ClearNonLiveTransitions later. | 1875 Object* enum_cache = *enum_cache_slot; |
1882 for (int i = 0; i < contents->length(); i += 2) { | 1876 base_marker()->MarkObjectAndPush( |
1883 PropertyDetails details(Smi::cast(contents->get(i + 1))); | 1877 reinterpret_cast<HeapObject*>(enum_cache)); |
1878 mark_compact_collector()->RecordSlot(descriptor_start, | |
1879 enum_cache_slot, | |
1880 enum_cache); | |
1881 } | |
1884 | 1882 |
1885 Object** slot = contents->data_start() + i; | 1883 // If the descriptor contains a transition (value is a Map), we don't mark the |
1886 if (!(*slot)->IsHeapObject()) continue; | 1884 // value as live. It might be set to the NULL_DESCRIPTOR in |
1887 HeapObject* value = HeapObject::cast(*slot); | 1885 // ClearNonLiveTransitions later. |
1886 for (int i = 0; i < descriptors->number_of_descriptors(); ++i) { | |
1887 Object** key_slot = descriptors->GetKeySlot(i); | |
1888 Object* key = *key_slot; | |
1889 if (key->IsHeapObject()) { | |
1890 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(key)); | |
1891 mark_compact_collector()->RecordSlot(descriptor_start, key_slot, key); | |
1892 } | |
1888 | 1893 |
1889 mark_compact_collector()->RecordSlot(slot, slot, *slot); | 1894 Object** value_slot = descriptors->GetValueSlot(i); |
1895 if (!(*value_slot)->IsHeapObject()) continue; | |
1896 HeapObject* value = HeapObject::cast(*value_slot); | |
1897 | |
1898 mark_compact_collector()->RecordSlot(descriptor_start, value_slot, *value_sl ot); | |
Florian Schneider
2012/05/22 16:53:09
Long line.
| |
1899 | |
1900 PropertyDetails details(descriptors->GetDetails(i)); | |
1890 | 1901 |
1891 switch (details.type()) { | 1902 switch (details.type()) { |
1892 case NORMAL: | 1903 case NORMAL: |
1893 case FIELD: | 1904 case FIELD: |
1894 case CONSTANT_FUNCTION: | 1905 case CONSTANT_FUNCTION: |
1895 case HANDLER: | 1906 case HANDLER: |
1896 case INTERCEPTOR: | 1907 case INTERCEPTOR: |
1897 base_marker()->MarkObjectAndPush(value); | 1908 base_marker()->MarkObjectAndPush(value); |
1898 break; | 1909 break; |
1899 case CALLBACKS: | 1910 case CALLBACKS: |
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4100 while (buffer != NULL) { | 4111 while (buffer != NULL) { |
4101 SlotsBuffer* next_buffer = buffer->next(); | 4112 SlotsBuffer* next_buffer = buffer->next(); |
4102 DeallocateBuffer(buffer); | 4113 DeallocateBuffer(buffer); |
4103 buffer = next_buffer; | 4114 buffer = next_buffer; |
4104 } | 4115 } |
4105 *buffer_address = NULL; | 4116 *buffer_address = NULL; |
4106 } | 4117 } |
4107 | 4118 |
4108 | 4119 |
4109 } } // namespace v8::internal | 4120 } } // namespace v8::internal |
OLD | NEW |