| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // | 52 // |
| 53 // The full format is: | 53 // The full format is: |
| 54 // [0] Undefined or back pointer map | 54 // [0] Undefined or back pointer map |
| 55 // [1] Smi(0) or elements transition map | 55 // [1] Smi(0) or elements transition map |
| 56 // [2] Smi(0) or fixed array of prototype transitions | 56 // [2] Smi(0) or fixed array of prototype transitions |
| 57 // [3] First transition | 57 // [3] First transition |
| 58 // [length() - kTransitionSize] Last transition | 58 // [length() - kTransitionSize] Last transition |
| 59 class TransitionArray: public FixedArray { | 59 class TransitionArray: public FixedArray { |
| 60 public: | 60 public: |
| 61 // Accessors for fetching instance transition at transition number. | 61 // Accessors for fetching instance transition at transition number. |
| 62 inline String* GetKey(int transition_number); | 62 inline Name* GetKey(int transition_number); |
| 63 inline void SetKey(int transition_number, String* value); | 63 inline void SetKey(int transition_number, Name* value); |
| 64 inline Object** GetKeySlot(int transition_number); | 64 inline Object** GetKeySlot(int transition_number); |
| 65 int GetSortedKeyIndex(int transition_number) { return transition_number; } | 65 int GetSortedKeyIndex(int transition_number) { return transition_number; } |
| 66 | 66 |
| 67 String* GetSortedKey(int transition_number) { | 67 Name* GetSortedKey(int transition_number) { |
| 68 return GetKey(transition_number); | 68 return GetKey(transition_number); |
| 69 } | 69 } |
| 70 | 70 |
| 71 inline Map* GetTarget(int transition_number); | 71 inline Map* GetTarget(int transition_number); |
| 72 inline void SetTarget(int transition_number, Map* target); | 72 inline void SetTarget(int transition_number, Map* target); |
| 73 | 73 |
| 74 inline PropertyDetails GetTargetDetails(int transition_number); | 74 inline PropertyDetails GetTargetDetails(int transition_number); |
| 75 | 75 |
| 76 inline Map* elements_transition(); | 76 inline Map* elements_transition(); |
| 77 inline void set_elements_transition( | 77 inline void set_elements_transition( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 98 if (IsSimpleTransition()) return 1; | 98 if (IsSimpleTransition()) return 1; |
| 99 int len = length(); | 99 int len = length(); |
| 100 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize; | 100 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize; |
| 101 } | 101 } |
| 102 | 102 |
| 103 inline int number_of_entries() { return number_of_transitions(); } | 103 inline int number_of_entries() { return number_of_transitions(); } |
| 104 | 104 |
| 105 // Allocate a new transition array with a single entry. | 105 // Allocate a new transition array with a single entry. |
| 106 static MUST_USE_RESULT MaybeObject* NewWith( | 106 static MUST_USE_RESULT MaybeObject* NewWith( |
| 107 SimpleTransitionFlag flag, | 107 SimpleTransitionFlag flag, |
| 108 String* key, | 108 Name* key, |
| 109 Map* target, | 109 Map* target, |
| 110 Object* back_pointer); | 110 Object* back_pointer); |
| 111 | 111 |
| 112 MUST_USE_RESULT MaybeObject* ExtendToFullTransitionArray(); | 112 MUST_USE_RESULT MaybeObject* ExtendToFullTransitionArray(); |
| 113 | 113 |
| 114 // Copy the transition array, inserting a new transition. | 114 // Copy the transition array, inserting a new transition. |
| 115 // TODO(verwaest): This should not cause an existing transition to be | 115 // TODO(verwaest): This should not cause an existing transition to be |
| 116 // overwritten. | 116 // overwritten. |
| 117 MUST_USE_RESULT MaybeObject* CopyInsert(String* name, Map* target); | 117 MUST_USE_RESULT MaybeObject* CopyInsert(Name* name, Map* target); |
| 118 | 118 |
| 119 // Copy a single transition from the origin array. | 119 // Copy a single transition from the origin array. |
| 120 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, | 120 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, |
| 121 int origin_transition, | 121 int origin_transition, |
| 122 int target_transition); | 122 int target_transition); |
| 123 | 123 |
| 124 // Search a transition for a given property name. | 124 // Search a transition for a given property name. |
| 125 inline int Search(String* name); | 125 inline int Search(Name* name); |
| 126 | 126 |
| 127 // Allocates a TransitionArray. | 127 // Allocates a TransitionArray. |
| 128 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_transitions); | 128 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_transitions); |
| 129 | 129 |
| 130 bool IsSimpleTransition() { return length() == kSimpleTransitionSize; } | 130 bool IsSimpleTransition() { return length() == kSimpleTransitionSize; } |
| 131 bool IsFullTransitionArray() { return length() >= kFirstIndex; } | 131 bool IsFullTransitionArray() { return length() >= kFirstIndex; } |
| 132 | 132 |
| 133 // Casting. | 133 // Casting. |
| 134 static inline TransitionArray* cast(Object* obj); | 134 static inline TransitionArray* cast(Object* obj); |
| 135 | 135 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 kTransitionKey; | 188 kTransitionKey; |
| 189 } | 189 } |
| 190 | 190 |
| 191 static int ToTargetIndex(int transition_number) { | 191 static int ToTargetIndex(int transition_number) { |
| 192 return kFirstIndex + | 192 return kFirstIndex + |
| 193 (transition_number * kTransitionSize) + | 193 (transition_number * kTransitionSize) + |
| 194 kTransitionTarget; | 194 kTransitionTarget; |
| 195 } | 195 } |
| 196 | 196 |
| 197 inline void NoIncrementalWriteBarrierSet(int transition_number, | 197 inline void NoIncrementalWriteBarrierSet(int transition_number, |
| 198 String* key, | 198 Name* key, |
| 199 Map* target); | 199 Map* target); |
| 200 | 200 |
| 201 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); | 201 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 | 204 |
| 205 } } // namespace v8::internal | 205 } } // namespace v8::internal |
| 206 | 206 |
| 207 #endif // V8_TRANSITIONS_H_ | 207 #endif // V8_TRANSITIONS_H_ |
| OLD | NEW |