Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index e3a1fd0d25c53f5874718fe86510a047082f768b..a804149a1665a5b9d307684aa950f21f4beee5df 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -2609,6 +2609,9 @@ class DescriptorArray: public FixedArray { |
| // Is the descriptor array sorted and without duplicates? |
| bool IsSortedNoDuplicates(); |
| + // Is the descriptor array consistent with the back pointers in targets? |
| + bool IsConsistentWithBackPointers(Map* current_map); |
| + |
| // Are two DescriptorArrays equal? |
| bool IsEqualTo(DescriptorArray* other); |
| #endif |
| @@ -4719,19 +4722,28 @@ class Map: public HeapObject { |
| // [stub cache]: contains stubs compiled for this map. |
| DECL_ACCESSORS(code_cache, Object) |
| + // [back pointer]: points back to the parent map from which a transition |
| + // leads to this map. The field overlaps with prototype transitions and the |
| + // back pointer will be moved into the prototype transitions array if |
| + // required. |
| + DECL_ACCESSORS(back_pointer, Object) |
|
Vyacheslav Egorov (Chromium)
2012/05/08 14:29:19
I would prefer if this was declared as GetBackPoin
Michael Starzinger
2012/05/09 07:30:02
Done.
|
| + |
| // [prototype transitions]: cache of prototype transitions. |
| // Prototype transition is a transition that happens |
| // when we change object's prototype to a new one. |
| // Cache format: |
| // 0: finger - index of the first free cell in the cache |
| - // 1 + 2 * i: prototype |
| - // 2 + 2 * i: target map |
| + // 1: back pointer that overlaps with prototype transitions field. |
| + // 2 + 2 * i: prototype |
| + // 3 + 2 * i: target map |
| DECL_ACCESSORS(prototype_transitions, FixedArray) |
| - inline FixedArray* unchecked_prototype_transitions(); |
| + inline void init_prototype_transitions(Object* undefined); |
| + inline HeapObject* unchecked_prototype_transitions(); |
| - static const int kProtoTransitionHeaderSize = 1; |
| + static const int kProtoTransitionHeaderSize = 2; |
| static const int kProtoTransitionNumberOfEntriesOffset = 0; |
| + static const int kProtoTransitionBackPointerOffset = 1; |
| static const int kProtoTransitionElementsPerEntry = 2; |
| static const int kProtoTransitionPrototypeOffset = 0; |
| static const int kProtoTransitionMapOffset = 1; |
| @@ -4803,25 +4815,10 @@ class Map: public HeapObject { |
| // Removes a code object from the code cache at the given index. |
| void RemoveFromCodeCache(String* name, Code* code, int index); |
| - // For every transition in this map, makes the transition's |
| - // target's prototype pointer point back to this map. |
| - // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). |
| - void CreateBackPointers(); |
| - |
| - void CreateOneBackPointer(Object* transition_target); |
| - |
| - // Set all map transitions from this map to dead maps to null. |
| - // Also, restore the original prototype on the targets of these |
| - // transitions, so that we do not process this map again while |
| - // following back pointers. |
| - void ClearNonLiveTransitions(Heap* heap, Object* real_prototype); |
| - |
| - // Restore a possible back pointer in the prototype field of object. |
| - // Return true in that case and false otherwise. Set *keep_entry to |
| - // true when a live map transition has been found. |
| - bool RestoreOneBackPointer(Object* object, |
| - Object* real_prototype, |
| - bool* keep_entry); |
| + // Set all map transitions from this map to dead maps to null. Also clear |
| + // back pointers in transition targets so that we do not process this map |
| + // again while following back pointers. |
| + void ClearNonLiveTransitions(Heap* heap); |
| // Computes a hash value for this map, to be used in HashTables and such. |
| int Hash(); |
| @@ -4903,16 +4900,17 @@ class Map: public HeapObject { |
| kConstructorOffset + kPointerSize; |
| static const int kCodeCacheOffset = |
| kInstanceDescriptorsOrBitField3Offset + kPointerSize; |
| - static const int kPrototypeTransitionsOffset = |
| + static const int kPrototypeTransitionsOrBackPointerOffset = |
| kCodeCacheOffset + kPointerSize; |
| - static const int kPadStart = kPrototypeTransitionsOffset + kPointerSize; |
| + static const int kPadStart = |
| + kPrototypeTransitionsOrBackPointerOffset + kPointerSize; |
| static const int kSize = MAP_POINTER_ALIGN(kPadStart); |
| // Layout of pointer fields. Heap iteration code relies on them |
| // being continuously allocated. |
| static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; |
| static const int kPointerFieldsEndOffset = |
| - Map::kPrototypeTransitionsOffset + kPointerSize; |
| + kPrototypeTransitionsOrBackPointerOffset + kPointerSize; |
| // Byte offsets within kInstanceSizesOffset. |
| static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; |