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 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1967 break; | 1967 break; |
1968 } | 1968 } |
1969 } | 1969 } |
1970 } | 1970 } |
1971 | 1971 |
1972 template <class T> | 1972 template <class T> |
1973 void Marker<T>::MarkTransitionArray(TransitionArray* transitions) { | 1973 void Marker<T>::MarkTransitionArray(TransitionArray* transitions) { |
1974 if (!base_marker()->MarkObjectWithoutPush(transitions)) return; | 1974 if (!base_marker()->MarkObjectWithoutPush(transitions)) return; |
1975 Object** transitions_start = transitions->data_start(); | 1975 Object** transitions_start = transitions->data_start(); |
1976 | 1976 |
1977 if (transitions->HasElementsTransition()) { | |
1978 mark_compact_collector()->RecordSlot( | |
1979 transitions_start, | |
1980 transitions->GetElementsTransitionSlot(), | |
1981 transitions->elements_transition()); | |
1982 } | |
1983 | |
1984 if (transitions->HasPrototypeTransitions()) { | 1977 if (transitions->HasPrototypeTransitions()) { |
1985 // Mark prototype transitions array but don't push it into marking stack. | 1978 // Mark prototype transitions array but don't push it into marking stack. |
1986 // This will make references from it weak. We will clean dead prototype | 1979 // This will make references from it weak. We will clean dead prototype |
1987 // transitions in ClearNonLiveTransitions. | 1980 // transitions in ClearNonLiveTransitions. |
1988 Object** proto_trans_slot = transitions->GetPrototypeTransitionsSlot(); | 1981 Object** proto_trans_slot = transitions->GetPrototypeTransitionsSlot(); |
1989 HeapObject* prototype_transitions = HeapObject::cast(*proto_trans_slot); | 1982 HeapObject* prototype_transitions = HeapObject::cast(*proto_trans_slot); |
1990 base_marker()->MarkObjectWithoutPush(prototype_transitions); | 1983 base_marker()->MarkObjectWithoutPush(prototype_transitions); |
1991 mark_compact_collector()->RecordSlot( | 1984 mark_compact_collector()->RecordSlot( |
1992 transitions_start, proto_trans_slot, prototype_transitions); | 1985 transitions_start, proto_trans_slot, prototype_transitions); |
1993 } | 1986 } |
1994 | 1987 |
1995 for (int i = 0; i < transitions->number_of_transitions(); ++i) { | 1988 for (int i = 0; i < transitions->number_of_transitions(); ++i) { |
1996 Object** key_slot = transitions->GetKeySlot(i); | 1989 Object** key_slot = transitions->GetKeySlot(i); |
1997 Object* key = *key_slot; | 1990 Object* key = *key_slot; |
1998 if (key->IsHeapObject()) { | 1991 if (key->IsHeapObject()) { |
1999 base_marker()->MarkObjectAndPush(HeapObject::cast(key)); | 1992 base_marker()->MarkObjectAndPush(HeapObject::cast(key)); |
2000 mark_compact_collector()->RecordSlot(transitions_start, key_slot, key); | 1993 mark_compact_collector()->RecordSlot(transitions_start, key_slot, key); |
2001 } | 1994 } |
2002 } | 1995 } |
2003 } | 1996 } |
2004 | 1997 |
2005 | 1998 |
2006 template <class T> | |
2007 void Marker<T>::MarkAccessorPairSlot(AccessorPair* accessors, int offset) { | |
2008 Object** slot = HeapObject::RawField(accessors, offset); | |
2009 HeapObject* accessor = HeapObject::cast(*slot); | |
2010 if (accessor->IsMap()) return; | |
2011 mark_compact_collector()->RecordSlot(slot, slot, accessor); | |
2012 base_marker()->MarkObjectAndPush(accessor); | |
2013 } | |
2014 | |
2015 | |
2016 // Fill the marking stack with overflowed objects returned by the given | 1999 // Fill the marking stack with overflowed objects returned by the given |
2017 // iterator. Stop when the marking stack is filled or the end of the space | 2000 // iterator. Stop when the marking stack is filled or the end of the space |
2018 // is reached, whichever comes first. | 2001 // is reached, whichever comes first. |
2019 template<class T> | 2002 template<class T> |
2020 static void DiscoverGreyObjectsWithIterator(Heap* heap, | 2003 static void DiscoverGreyObjectsWithIterator(Heap* heap, |
2021 MarkingDeque* marking_deque, | 2004 MarkingDeque* marking_deque, |
2022 T* it) { | 2005 T* it) { |
2023 // The caller should ensure that the marking stack is initially not full, | 2006 // The caller should ensure that the marking stack is initially not full, |
2024 // so that we don't waste effort pointlessly scanning for objects. | 2007 // so that we don't waste effort pointlessly scanning for objects. |
2025 ASSERT(!marking_deque->IsFull()); | 2008 ASSERT(!marking_deque->IsFull()); |
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4186 while (buffer != NULL) { | 4169 while (buffer != NULL) { |
4187 SlotsBuffer* next_buffer = buffer->next(); | 4170 SlotsBuffer* next_buffer = buffer->next(); |
4188 DeallocateBuffer(buffer); | 4171 DeallocateBuffer(buffer); |
4189 buffer = next_buffer; | 4172 buffer = next_buffer; |
4190 } | 4173 } |
4191 *buffer_address = NULL; | 4174 *buffer_address = NULL; |
4192 } | 4175 } |
4193 | 4176 |
4194 | 4177 |
4195 } } // namespace v8::internal | 4178 } } // namespace v8::internal |
OLD | NEW |