Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index e3a1fd0d25c53f5874718fe86510a047082f768b..7d81044b9d98bd52fda26fcf1d610f5099f39c66 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,30 @@ 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. |
+ inline Object* GetBackPointer(); |
+ inline void SetBackPointer(Object* value, |
+ WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
+ |
// [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 +4817,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 +4902,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; |