Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index b04e2707c09d462f6e9dd3efec6e24dbd36b2299..5945825991abeb5aaefbfb1c31a18d87b01e24c4 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -2400,10 +2400,13 @@ class DescriptorArray: public FixedArray { |
| // map uses to encode additional bit fields when the descriptor array is not |
| // yet used. |
| inline bool IsEmpty(); |
| + inline bool MayContainTransitions(); |
| + |
| + DECL_ACCESSORS(elements_transition, Map) |
|
danno
2012/06/01 13:49:55
probably should call this elements_transition_map
Toon Verwaest
2012/06/04 09:17:48
Done.
|
| // Returns the number of descriptors in the array. |
| int number_of_descriptors() { |
| - ASSERT(length() > kFirstIndex || IsEmpty()); |
| + ASSERT(length() >= kFirstIndex || IsEmpty()); |
|
danno
2012/06/01 13:49:55
ASSERT(length() > kFirstIndex || length() == kTran
Toon Verwaest
2012/06/04 09:17:48
Done.
|
| int len = length(); |
| return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kDescriptorSize; |
| } |
| @@ -2441,6 +2444,12 @@ class DescriptorArray: public FixedArray { |
| kEnumerationIndexOffset); |
| } |
| + Object** GetTransitionsSlot() { |
| + ASSERT(elements_transition() != NULL); |
| + return HeapObject::RawField(reinterpret_cast<HeapObject*>(this), |
| + kTransitionsOffset); |
| + } |
| + |
| // TODO(1399): It should be possible to make room for bit_field3 in the map |
| // without overloading the instance descriptors field in the map |
| // (and storing it in the DescriptorArray when the map has one). |
| @@ -2519,7 +2528,7 @@ class DescriptorArray: public FixedArray { |
| // Return a copy of the array with all transitions and null descriptors |
| // removed. Return a Failure object in case of an allocation failure. |
| - MUST_USE_RESULT MaybeObject* RemoveTransitions(); |
| + MUST_USE_RESULT MaybeObject* RemoveTransitions(bool mutable_transitions); |
| // Sort the instance descriptors by the hash codes of their keys. |
| // Does not check for duplicates. |
| @@ -2552,7 +2561,8 @@ class DescriptorArray: public FixedArray { |
| // Allocates a DescriptorArray, but returns the singleton |
| // empty descriptor array object if number_of_descriptors is 0. |
| - MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors); |
| + MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors, |
| + bool mutable_transitions); |
|
danno
2012/06/01 13:49:55
Turn this into an enum.
Toon Verwaest
2012/06/04 09:17:48
Done.
|
| // Casting. |
| static inline DescriptorArray* cast(Object* obj); |
| @@ -2561,8 +2571,9 @@ class DescriptorArray: public FixedArray { |
| static const int kNotFound = -1; |
| static const int kBitField3StorageIndex = 0; |
| - static const int kEnumerationIndexIndex = 1; |
| - static const int kFirstIndex = 2; |
| + static const int kTransitionsIndex = 1; |
| + static const int kEnumerationIndexIndex = 2; |
| + static const int kFirstIndex = 3; |
| // The length of the "bridge" to the enum cache. |
| static const int kEnumCacheBridgeLength = 3; |
| @@ -2572,8 +2583,8 @@ class DescriptorArray: public FixedArray { |
| // Layout description. |
| static const int kBitField3StorageOffset = FixedArray::kHeaderSize; |
| - static const int kEnumerationIndexOffset = kBitField3StorageOffset + |
| - kPointerSize; |
| + static const int kTransitionsOffset = kBitField3StorageOffset + kPointerSize; |
| + static const int kEnumerationIndexOffset = kTransitionsOffset + kPointerSize; |
| static const int kFirstOffset = kEnumerationIndexOffset + kPointerSize; |
| // Layout description for the bridge array. |
| @@ -4679,6 +4690,9 @@ class Map: public HeapObject { |
| static bool IsValidElementsTransition(ElementsKind from_kind, |
| ElementsKind to_kind); |
| + inline Map* elements_transition(); |
| + inline void set_elements_transition(Map* transitioned_map); |
| + |
| // Tells whether the map is attached to SharedFunctionInfo |
| // (for inobject slack tracking). |
| inline void set_attached_to_shared_function_info(bool value); |
| @@ -4775,7 +4789,7 @@ class Map: public HeapObject { |
| // Returns a copy of the map, with all transitions dropped from the |
| // instance descriptors. |
| - MUST_USE_RESULT MaybeObject* CopyDropTransitions(); |
| + MUST_USE_RESULT MaybeObject* CopyDropTransitions(bool mutable_transitions); |
|
danno
2012/06/01 13:49:55
Enum instead of bool
Toon Verwaest
2012/06/04 09:17:48
Done.
|
| // Returns the property index for name (only valid for FAST MODE). |
| int PropertyIndexFor(String* name); |
| @@ -4828,23 +4842,15 @@ class Map: public HeapObject { |
| // The "shared" flags of both this map and |other| are ignored. |
| bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode); |
| - // Returns the contents of this map's descriptor array for the given string. |
| - // May return NULL. |safe_to_add_transition| is set to false and NULL |
| - // is returned if adding transitions is not allowed. |
| - Object* GetDescriptorContents(String* sentinel_name, |
| - bool* safe_to_add_transitions); |
| - |
| // Returns the map that this map transitions to if its elements_kind |
| // is changed to |elements_kind|, or NULL if no such map is cached yet. |
| // |safe_to_add_transitions| is set to false if adding transitions is not |
| // allowed. |
| - Map* LookupElementsTransitionMap(ElementsKind elements_kind, |
| - bool* safe_to_add_transition); |
| + Map* LookupElementsTransitionMap(ElementsKind elements_kind); |
| - // Adds an entry to this map's descriptor array for a transition to |
| - // |transitioned_map| when its elements_kind is changed to |elements_kind|. |
| - MUST_USE_RESULT MaybeObject* AddElementsTransition( |
| - ElementsKind elements_kind, Map* transitioned_map); |
| + // Adds a new transitions for changing the elements kind to |elements_kind|. |
| + MUST_USE_RESULT MaybeObject* CreateNextElementsTransition( |
| + ElementsKind elements_kind); |
| // Returns the transitioned map for this map with the most generic |
| // elements_kind that's found in |candidates|, or null handle if no match is |
| @@ -4986,7 +4992,6 @@ class Map: public HeapObject { |
| kSize> BodyDescriptor; |
| private: |
| - String* elements_transition_sentinel_name(); |
| DISALLOW_IMPLICIT_CONSTRUCTORS(Map); |
| }; |