Chromium Code Reviews| 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 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1885 if (descriptors->HasEnumCache()) { | 1885 if (descriptors->HasEnumCache()) { |
| 1886 Object** enum_cache_slot = descriptors->GetEnumCacheSlot(); | 1886 Object** enum_cache_slot = descriptors->GetEnumCacheSlot(); |
| 1887 Object* enum_cache = *enum_cache_slot; | 1887 Object* enum_cache = *enum_cache_slot; |
| 1888 base_marker()->MarkObjectAndPush( | 1888 base_marker()->MarkObjectAndPush( |
| 1889 reinterpret_cast<HeapObject*>(enum_cache)); | 1889 reinterpret_cast<HeapObject*>(enum_cache)); |
| 1890 mark_compact_collector()->RecordSlot(descriptor_start, | 1890 mark_compact_collector()->RecordSlot(descriptor_start, |
| 1891 enum_cache_slot, | 1891 enum_cache_slot, |
| 1892 enum_cache); | 1892 enum_cache); |
| 1893 } | 1893 } |
| 1894 | 1894 |
| 1895 if (descriptors->elements_transition_map() != NULL) { | 1895 if (descriptors->HasTransitionArray()) { |
| 1896 Object** transitions_slot = descriptors->GetTransitionsSlot(); | 1896 Object** transitions_slot = descriptors->GetTransitionsSlot(); |
| 1897 Object* transitions = *transitions_slot; | 1897 Object* transitions = *transitions_slot; |
| 1898 mark_compact_collector()->RecordSlot(descriptor_start, | 1898 mark_compact_collector()->RecordSlot(descriptor_start, |
| 1899 transitions_slot, | 1899 transitions_slot, |
| 1900 transitions); | 1900 transitions); |
| 1901 MarkTransitionArray(reinterpret_cast<TransitionArray*>(transitions)); | |
| 1901 } | 1902 } |
| 1902 | 1903 |
| 1903 // If the descriptor contains a transition (value is a Map), we don't mark the | 1904 // If the descriptor contains a transition (value is a Map), we don't mark the |
| 1904 // value as live. It might be removed by ClearNonLiveTransitions later. | 1905 // value as live. It might be removed by ClearNonLiveTransitions later. |
| 1905 for (int i = 0; i < descriptors->number_of_descriptors(); ++i) { | 1906 for (int i = 0; i < descriptors->number_of_descriptors(); ++i) { |
| 1906 Object** key_slot = descriptors->GetKeySlot(i); | 1907 Object** key_slot = descriptors->GetKeySlot(i); |
| 1907 Object* key = *key_slot; | 1908 Object* key = *key_slot; |
| 1908 if (key->IsHeapObject()) { | 1909 if (key->IsHeapObject()) { |
| 1909 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(key)); | 1910 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(key)); |
|
Michael Starzinger
2012/06/28 16:02:12
We can also use HeapObject::cast() here.
Toon Verwaest
2012/06/29 08:14:55
Done.
| |
| 1910 mark_compact_collector()->RecordSlot(descriptor_start, key_slot, key); | 1911 mark_compact_collector()->RecordSlot(descriptor_start, key_slot, key); |
| 1911 } | 1912 } |
| 1912 | 1913 |
| 1913 Object** value_slot = descriptors->GetValueSlot(i); | 1914 Object** value_slot = descriptors->GetValueSlot(i); |
| 1914 if (!(*value_slot)->IsHeapObject()) continue; | 1915 if (!(*value_slot)->IsHeapObject()) continue; |
| 1915 HeapObject* value = HeapObject::cast(*value_slot); | 1916 HeapObject* value = HeapObject::cast(*value_slot); |
| 1916 | 1917 |
| 1917 mark_compact_collector()->RecordSlot(descriptor_start, | 1918 mark_compact_collector()->RecordSlot(descriptor_start, |
| 1918 value_slot, | 1919 value_slot, |
| 1919 value); | 1920 value); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1930 break; | 1931 break; |
| 1931 case CALLBACKS: | 1932 case CALLBACKS: |
| 1932 if (!value->IsAccessorPair()) { | 1933 if (!value->IsAccessorPair()) { |
| 1933 base_marker()->MarkObjectAndPush(value); | 1934 base_marker()->MarkObjectAndPush(value); |
| 1934 } else if (base_marker()->MarkObjectWithoutPush(value)) { | 1935 } else if (base_marker()->MarkObjectWithoutPush(value)) { |
| 1935 AccessorPair* accessors = AccessorPair::cast(value); | 1936 AccessorPair* accessors = AccessorPair::cast(value); |
| 1936 MarkAccessorPairSlot(accessors, AccessorPair::kGetterOffset); | 1937 MarkAccessorPairSlot(accessors, AccessorPair::kGetterOffset); |
| 1937 MarkAccessorPairSlot(accessors, AccessorPair::kSetterOffset); | 1938 MarkAccessorPairSlot(accessors, AccessorPair::kSetterOffset); |
| 1938 } | 1939 } |
| 1939 break; | 1940 break; |
| 1940 case MAP_TRANSITION: | 1941 case TRANSITION: |
| 1941 case CONSTANT_TRANSITION: | |
| 1942 break; | |
| 1943 case NONEXISTENT: | 1942 case NONEXISTENT: |
| 1944 UNREACHABLE(); | 1943 UNREACHABLE(); |
| 1945 break; | 1944 break; |
| 1946 } | 1945 } |
| 1947 } | 1946 } |
| 1948 } | 1947 } |
| 1949 | 1948 |
| 1949 template <class T> | |
| 1950 void Marker<T>::MarkTransitionArray(TransitionArray* transitions) { | |
| 1951 ASSERT(transitions != NULL); | |
| 1952 if (!base_marker()->MarkObjectWithoutPush(transitions)) return; | |
| 1953 Object** transitions_start = transitions->data_start(); | |
| 1954 | |
| 1955 if (transitions->elements() != NULL) { | |
| 1956 mark_compact_collector()->RecordSlot(transitions_start, | |
| 1957 transitions->GetElementsSlot(), | |
| 1958 transitions->elements()); | |
| 1959 } | |
| 1960 | |
| 1961 for (int i = 0; i < transitions->number_of_transitions(); ++i) { | |
| 1962 Object** key_slot = transitions->GetKeySlot(i); | |
| 1963 Object* key = *key_slot; | |
| 1964 if (key->IsHeapObject()) { | |
| 1965 base_marker()->MarkObjectAndPush(reinterpret_cast<HeapObject*>(key)); | |
|
Michael Starzinger
2012/06/28 16:02:12
Use HeapObject::cast() here.
Toon Verwaest
2012/06/29 08:14:55
Done.
| |
| 1966 mark_compact_collector()->RecordSlot(transitions_start, key_slot, key); | |
| 1967 } | |
| 1968 | |
| 1969 Object** value_slot = transitions->GetValueSlot(i); | |
| 1970 if (!(*value_slot)->IsHeapObject()) continue; | |
| 1971 HeapObject* value = HeapObject::cast(*value_slot); | |
| 1972 | |
| 1973 mark_compact_collector()->RecordSlot(transitions_start, | |
| 1974 value_slot, | |
| 1975 value); | |
| 1976 | |
| 1977 if (value->IsAccessorPair()) { | |
| 1978 base_marker()->MarkObjectWithoutPush(value); | |
|
Michael Starzinger
2012/06/28 16:02:12
We only need to mark the slots if the pair itself
Toon Verwaest
2012/06/29 08:14:55
Done.
| |
| 1979 AccessorPair* accessors = AccessorPair::cast(value); | |
| 1980 MarkAccessorPairSlot(accessors, AccessorPair::kGetterOffset); | |
| 1981 MarkAccessorPairSlot(accessors, AccessorPair::kSetterOffset); | |
| 1982 } | |
| 1983 } | |
| 1984 } | |
| 1985 | |
| 1950 | 1986 |
| 1951 template <class T> | 1987 template <class T> |
| 1952 void Marker<T>::MarkAccessorPairSlot(AccessorPair* accessors, int offset) { | 1988 void Marker<T>::MarkAccessorPairSlot(AccessorPair* accessors, int offset) { |
| 1953 Object** slot = HeapObject::RawField(accessors, offset); | 1989 Object** slot = HeapObject::RawField(accessors, offset); |
| 1954 HeapObject* accessor = HeapObject::cast(*slot); | 1990 HeapObject* accessor = HeapObject::cast(*slot); |
| 1955 if (accessor->IsMap()) return; | 1991 if (accessor->IsMap()) return; |
| 1956 mark_compact_collector()->RecordSlot(slot, slot, accessor); | 1992 mark_compact_collector()->RecordSlot(slot, slot, accessor); |
| 1957 base_marker()->MarkObjectAndPush(accessor); | 1993 base_marker()->MarkObjectAndPush(accessor); |
| 1958 } | 1994 } |
| 1959 | 1995 |
| (...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4125 while (buffer != NULL) { | 4161 while (buffer != NULL) { |
| 4126 SlotsBuffer* next_buffer = buffer->next(); | 4162 SlotsBuffer* next_buffer = buffer->next(); |
| 4127 DeallocateBuffer(buffer); | 4163 DeallocateBuffer(buffer); |
| 4128 buffer = next_buffer; | 4164 buffer = next_buffer; |
| 4129 } | 4165 } |
| 4130 *buffer_address = NULL; | 4166 *buffer_address = NULL; |
| 4131 } | 4167 } |
| 4132 | 4168 |
| 4133 | 4169 |
| 4134 } } // namespace v8::internal | 4170 } } // namespace v8::internal |
| OLD | NEW |