Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: src/mark-compact.cc

Issue 10697015: Separating transitions from descriptors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Using WhitenessWitness in TransitionArray code. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mark-compact.h ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(HeapObject::cast(key));
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
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 if (!base_marker()->MarkObjectWithoutPush(transitions)) return;
1952 Object** transitions_start = transitions->data_start();
1953
1954 if (transitions->HasElementsTransition()) {
1955 mark_compact_collector()->RecordSlot(transitions_start,
1956 transitions->GetElementsSlot(),
1957 transitions->elements_transition());
1958 }
1959
1960 for (int i = 0; i < transitions->number_of_transitions(); ++i) {
1961 Object** key_slot = transitions->GetKeySlot(i);
1962 Object* key = *key_slot;
1963 if (key->IsHeapObject()) {
1964 base_marker()->MarkObjectAndPush(HeapObject::cast(key));
1965 mark_compact_collector()->RecordSlot(transitions_start, key_slot, key);
1966 }
1967
1968 Object** value_slot = transitions->GetValueSlot(i);
1969 if (!(*value_slot)->IsHeapObject()) continue;
1970 HeapObject* value = HeapObject::cast(*value_slot);
1971
1972 if (value->IsAccessorPair()) {
1973 mark_compact_collector()->RecordSlot(transitions_start,
1974 value_slot,
1975 value);
1976
1977 base_marker()->MarkObjectWithoutPush(value);
1978 AccessorPair* accessors = AccessorPair::cast(value);
1979 MarkAccessorPairSlot(accessors, AccessorPair::kGetterOffset);
1980 MarkAccessorPairSlot(accessors, AccessorPair::kSetterOffset);
1981 }
1982 }
1983 }
1984
1950 1985
1951 template <class T> 1986 template <class T>
1952 void Marker<T>::MarkAccessorPairSlot(AccessorPair* accessors, int offset) { 1987 void Marker<T>::MarkAccessorPairSlot(AccessorPair* accessors, int offset) {
1953 Object** slot = HeapObject::RawField(accessors, offset); 1988 Object** slot = HeapObject::RawField(accessors, offset);
1954 HeapObject* accessor = HeapObject::cast(*slot); 1989 HeapObject* accessor = HeapObject::cast(*slot);
1955 if (accessor->IsMap()) return; 1990 if (accessor->IsMap()) return;
1956 mark_compact_collector()->RecordSlot(slot, slot, accessor); 1991 mark_compact_collector()->RecordSlot(slot, slot, accessor);
1957 base_marker()->MarkObjectAndPush(accessor); 1992 base_marker()->MarkObjectAndPush(accessor);
1958 } 1993 }
1959 1994
(...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after
4125 while (buffer != NULL) { 4160 while (buffer != NULL) {
4126 SlotsBuffer* next_buffer = buffer->next(); 4161 SlotsBuffer* next_buffer = buffer->next();
4127 DeallocateBuffer(buffer); 4162 DeallocateBuffer(buffer);
4128 buffer = next_buffer; 4163 buffer = next_buffer;
4129 } 4164 }
4130 *buffer_address = NULL; 4165 *buffer_address = NULL;
4131 } 4166 }
4132 4167
4133 4168
4134 } } // namespace v8::internal 4169 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698