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 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1857 Object* obj = *slot; | 1857 Object* obj = *slot; |
1858 if (!obj->NonFailureIsHeapObject()) continue; | 1858 if (!obj->NonFailureIsHeapObject()) continue; |
1859 mark_compact_collector()->RecordSlot(start_slot, slot, obj); | 1859 mark_compact_collector()->RecordSlot(start_slot, slot, obj); |
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 // printf("marking: %p\n", static_cast<void*>(descriptors)); | |
danno
2012/06/01 13:49:55
Remove debugging code.
Toon Verwaest
2012/06/04 09:17:48
Done.
| |
1867 // Empty descriptor array is marked as a root before any maps are marked. | 1868 // Empty descriptor array is marked as a root before any maps are marked. |
1868 ASSERT(descriptors != descriptors->GetHeap()->empty_descriptor_array()); | 1869 ASSERT(descriptors != descriptors->GetHeap()->empty_descriptor_array()); |
1869 | 1870 |
1870 if (!base_marker()->MarkObjectWithoutPush(descriptors)) return; | 1871 if (!base_marker()->MarkObjectWithoutPush(descriptors)) return; |
1871 Object** descriptor_start = descriptors->data_start(); | 1872 Object** descriptor_start = descriptors->data_start(); |
1872 | 1873 |
1873 if (descriptors->HasEnumCache()) { | 1874 if (descriptors->HasEnumCache()) { |
1874 Object** enum_cache_slot = descriptors->GetEnumCacheSlot(); | 1875 Object** enum_cache_slot = descriptors->GetEnumCacheSlot(); |
1875 Object* enum_cache = *enum_cache_slot; | 1876 Object* enum_cache = *enum_cache_slot; |
1876 base_marker()->MarkObjectAndPush( | 1877 base_marker()->MarkObjectAndPush( |
1877 reinterpret_cast<HeapObject*>(enum_cache)); | 1878 reinterpret_cast<HeapObject*>(enum_cache)); |
1878 mark_compact_collector()->RecordSlot(descriptor_start, | 1879 mark_compact_collector()->RecordSlot(descriptor_start, |
1879 enum_cache_slot, | 1880 enum_cache_slot, |
1880 enum_cache); | 1881 enum_cache); |
1881 } | 1882 } |
1882 | 1883 |
1884 // TODO(verwaest) Make sure we free unused transitions. | |
1885 if (descriptors->elements_transition() != NULL) { | |
1886 Object** transitions_slot = descriptors->GetTransitionsSlot(); | |
1887 Object* transitions = *transitions_slot; | |
1888 base_marker()->MarkObjectAndPush( | |
1889 reinterpret_cast<HeapObject*>(transitions)); | |
1890 mark_compact_collector()->RecordSlot(descriptor_start, | |
1891 transitions_slot, | |
1892 transitions); | |
1893 } | |
1894 | |
1883 // If the descriptor contains a transition (value is a Map), we don't mark the | 1895 // If the descriptor contains a transition (value is a Map), we don't mark the |
1884 // value as live. It might be set to the NULL_DESCRIPTOR in | 1896 // value as live. It might be set to the NULL_DESCRIPTOR in |
1885 // ClearNonLiveTransitions later. | 1897 // ClearNonLiveTransitions later. |
1886 for (int i = 0; i < descriptors->number_of_descriptors(); ++i) { | 1898 for (int i = 0; i < descriptors->number_of_descriptors(); ++i) { |
1887 Object** key_slot = descriptors->GetKeySlot(i); | 1899 Object** key_slot = descriptors->GetKeySlot(i); |
1888 Object* key = *key_slot; | 1900 Object* key = *key_slot; |
1889 if (key->IsHeapObject()) { | 1901 if (key->IsHeapObject()) { |
1890 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(key)); | 1902 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(key)); |
1891 mark_compact_collector()->RecordSlot(descriptor_start, key_slot, key); | 1903 mark_compact_collector()->RecordSlot(descriptor_start, key_slot, key); |
1892 } | 1904 } |
(...skipping 18 matching lines...) Expand all Loading... | |
1911 break; | 1923 break; |
1912 case CALLBACKS: | 1924 case CALLBACKS: |
1913 if (!value->IsAccessorPair()) { | 1925 if (!value->IsAccessorPair()) { |
1914 base_marker()->MarkObjectAndPush(value); | 1926 base_marker()->MarkObjectAndPush(value); |
1915 } else if (base_marker()->MarkObjectWithoutPush(value)) { | 1927 } else if (base_marker()->MarkObjectWithoutPush(value)) { |
1916 AccessorPair* accessors = AccessorPair::cast(value); | 1928 AccessorPair* accessors = AccessorPair::cast(value); |
1917 MarkAccessorPairSlot(accessors, AccessorPair::kGetterOffset); | 1929 MarkAccessorPairSlot(accessors, AccessorPair::kGetterOffset); |
1918 MarkAccessorPairSlot(accessors, AccessorPair::kSetterOffset); | 1930 MarkAccessorPairSlot(accessors, AccessorPair::kSetterOffset); |
1919 } | 1931 } |
1920 break; | 1932 break; |
1921 case ELEMENTS_TRANSITION: | |
1922 // For maps with multiple elements transitions, the transition maps are | |
1923 // stored in a FixedArray. Keep the fixed array alive but not the maps | |
1924 // that it refers to. | |
1925 if (value->IsFixedArray()) base_marker()->MarkObjectWithoutPush(value); | |
1926 break; | |
1927 case MAP_TRANSITION: | 1933 case MAP_TRANSITION: |
1928 case CONSTANT_TRANSITION: | 1934 case CONSTANT_TRANSITION: |
1929 case NULL_DESCRIPTOR: | 1935 case NULL_DESCRIPTOR: |
1930 break; | 1936 break; |
1931 } | 1937 } |
1932 } | 1938 } |
1933 } | 1939 } |
1934 | 1940 |
1935 | 1941 |
1936 template <class T> | 1942 template <class T> |
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4115 while (buffer != NULL) { | 4121 while (buffer != NULL) { |
4116 SlotsBuffer* next_buffer = buffer->next(); | 4122 SlotsBuffer* next_buffer = buffer->next(); |
4117 DeallocateBuffer(buffer); | 4123 DeallocateBuffer(buffer); |
4118 buffer = next_buffer; | 4124 buffer = next_buffer; |
4119 } | 4125 } |
4120 *buffer_address = NULL; | 4126 *buffer_address = NULL; |
4121 } | 4127 } |
4122 | 4128 |
4123 | 4129 |
4124 } } // namespace v8::internal | 4130 } } // namespace v8::internal |
OLD | NEW |