Chromium Code Reviews| Index: src/transitions.h |
| diff --git a/src/transitions.h b/src/transitions.h |
| index 7abef47346870a012fc1e6c86c1b52bec10aa3ae..631f6bd8fe747dd17a0a6c6838f3afe88b0bd687 100644 |
| --- a/src/transitions.h |
| +++ b/src/transitions.h |
| @@ -41,10 +41,10 @@ namespace internal { |
| // TransitionArrays are fixed arrays used to hold map transitions for property, |
| // constant, and element changes. They can either be simple transition arrays |
| // that store a single property transition, or a full transition array that has |
| -// space for elements transitions, prototype transitions and multiple property |
| -// transitons. The details related to property transitions are accessed in the |
| -// descriptor array of the target map. In the case of a simple transition, the |
| -// key is also read from the descriptor array of the target map. |
| +// prototype transitions and multiple property transitons. The details related |
| +// to property transitions are accessed in the descriptor array of the target |
| +// map. In the case of a simple transition, the key is also read from the |
| +// descriptor array of the target map. |
| // |
| // The simple format of the these objects is: |
| // [0] Undefined or back pointer map |
| @@ -52,9 +52,8 @@ namespace internal { |
| // |
| // The full format is: |
| // [0] Undefined or back pointer map |
| -// [1] Smi(0) or elements transition map |
| -// [2] Smi(0) or fixed array of prototype transitions |
| -// [3] First transition |
| +// [1] Smi(0) or fixed array of prototype transitions |
| +// [2] First transition |
| // [length() - kTransitionSize] Last transition |
| class TransitionArray: public FixedArray { |
| public: |
| @@ -73,12 +72,7 @@ class TransitionArray: public FixedArray { |
| inline PropertyDetails GetTargetDetails(int transition_number); |
| - inline Map* elements_transition(); |
| - inline void set_elements_transition( |
| - Map* target, |
| - WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| inline bool HasElementsTransition(); |
| - inline void ClearElementsTransition(); |
| inline Object* back_pointer_storage(); |
| inline void set_back_pointer_storage( |
| @@ -127,8 +121,22 @@ class TransitionArray: public FixedArray { |
| // Allocates a TransitionArray. |
| MUST_USE_RESULT static MaybeObject* Allocate(int number_of_transitions); |
| - bool IsSimpleTransition() { return length() == kSimpleTransitionSize; } |
| - bool IsFullTransitionArray() { return length() >= kFirstIndex; } |
| + bool IsSimpleTransition() { |
| + return length() == kSimpleTransitionSize && |
| + get(kSimpleTransitionTarget)->IsHeapObject() && |
| + // The IntrusivePrototypeTransitionIterator may have set the map of the |
| + // prototype transitions array to a smi. In that case, there are |
| + // prototype transitions, hence this transition array is a full |
| + // transition array. |
| + (*HeapObject::RawField(HeapObject::cast(get(kSimpleTransitionTarget)), |
|
titzer
2013/07/31 13:55:46
Any reason to use a RawField as opposed to the map
Toon Verwaest
2013/07/31 15:05:23
Done.
|
| + HeapObject::kMapOffset))->IsMap() && |
| + get(kSimpleTransitionTarget)->IsMap(); |
| + } |
| + |
| + bool IsFullTransitionArray() { |
| + return length() > kFirstIndex || |
| + (length() == kFirstIndex && !IsSimpleTransition()); |
| + } |
| // Casting. |
| static inline TransitionArray* cast(Object* obj); |
| @@ -139,9 +147,8 @@ class TransitionArray: public FixedArray { |
| static const int kBackPointerStorageIndex = 0; |
| // Layout for full transition arrays. |
| - static const int kElementsTransitionIndex = 1; |
| - static const int kPrototypeTransitionsIndex = 2; |
| - static const int kFirstIndex = 3; |
| + static const int kPrototypeTransitionsIndex = 1; |
| + static const int kFirstIndex = 2; |
| // Layout for simple transition arrays. |
| static const int kSimpleTransitionTarget = 1; |
| @@ -152,9 +159,7 @@ class TransitionArray: public FixedArray { |
| static const int kBackPointerStorageOffset = FixedArray::kHeaderSize; |
| // Layout for the full transition array header. |
| - static const int kElementsTransitionOffset = kBackPointerStorageOffset + |
| - kPointerSize; |
| - static const int kPrototypeTransitionsOffset = kElementsTransitionOffset + |
| + static const int kPrototypeTransitionsOffset = kBackPointerStorageOffset + |
| kPointerSize; |
| // Layout of map transition entries in full transition arrays. |