OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_TRANSITIONS_H_ | 5 #ifndef V8_TRANSITIONS_H_ |
6 #define V8_TRANSITIONS_H_ | 6 #define V8_TRANSITIONS_H_ |
7 | 7 |
8 #include "src/checks.h" | 8 #include "src/checks.h" |
9 #include "src/elements-kind.h" | 9 #include "src/elements-kind.h" |
10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 // Create a transition array, copying from the owning map if it already has | 81 // Create a transition array, copying from the owning map if it already has |
82 // one, otherwise creating a new one according to flag. | 82 // one, otherwise creating a new one according to flag. |
83 // TODO(verwaest): This should not cause an existing transition to be | 83 // TODO(verwaest): This should not cause an existing transition to be |
84 // overwritten. | 84 // overwritten. |
85 static Handle<TransitionArray> CopyInsert(Handle<Map> map, | 85 static Handle<TransitionArray> CopyInsert(Handle<Map> map, |
86 Handle<Name> name, | 86 Handle<Name> name, |
87 Handle<Map> target, | 87 Handle<Map> target, |
88 SimpleTransitionFlag flag); | 88 SimpleTransitionFlag flag); |
89 | 89 |
90 // Search a transition for a given property name. | 90 // Search a transition for a given type, property name and attributes. |
91 inline int Search(Name* name); | 91 int Search(PropertyType type, Name* name, PropertyAttributes attributes); |
| 92 |
| 93 // Search a non-property transition (like elements kind, observe or frozen |
| 94 // transitions). |
| 95 inline int SearchSpecial(Symbol* symbol) { return SearchFirst(symbol); } |
| 96 |
| 97 // Returns true for a non-property transitions like elements kind, observed |
| 98 // or frozen transitions. |
| 99 inline static bool IsSpecialTransition(Name* name); |
| 100 |
| 101 inline static PropertyDetails GetTargetDetails(Name* name, Map* target); |
92 | 102 |
93 // Allocates a TransitionArray. | 103 // Allocates a TransitionArray. |
94 static Handle<TransitionArray> Allocate( | 104 static Handle<TransitionArray> Allocate( |
95 Isolate* isolate, int number_of_transitions); | 105 Isolate* isolate, int number_of_transitions); |
96 | 106 |
97 bool IsSimpleTransition() { | 107 bool IsSimpleTransition() { |
98 return length() == kSimpleTransitionSize && | 108 return length() == kSimpleTransitionSize && |
99 get(kSimpleTransitionTarget)->IsHeapObject() && | 109 get(kSimpleTransitionTarget)->IsHeapObject() && |
100 // The IntrusivePrototypeTransitionIterator may have set the map of the | 110 // The IntrusivePrototypeTransitionIterator may have set the map of the |
101 // prototype transitions array to a smi. In that case, there are | 111 // prototype transitions array to a smi. In that case, there are |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 180 |
171 static Handle<TransitionArray> AllocateSimple( | 181 static Handle<TransitionArray> AllocateSimple( |
172 Isolate* isolate, Handle<Map> target); | 182 Isolate* isolate, Handle<Map> target); |
173 | 183 |
174 // Allocate a new transition array with a single entry. | 184 // Allocate a new transition array with a single entry. |
175 static Handle<TransitionArray> NewWith(Handle<Map> map, | 185 static Handle<TransitionArray> NewWith(Handle<Map> map, |
176 Handle<Name> name, | 186 Handle<Name> name, |
177 Handle<Map> target, | 187 Handle<Map> target, |
178 SimpleTransitionFlag flag); | 188 SimpleTransitionFlag flag); |
179 | 189 |
| 190 // Search a first transition for a given property name. |
| 191 inline int SearchFirst(Name* name); |
| 192 int SearchNext(int transition, PropertyType type, Name* name, |
| 193 PropertyAttributes attributes); |
| 194 |
180 inline void NoIncrementalWriteBarrierSet(int transition_number, | 195 inline void NoIncrementalWriteBarrierSet(int transition_number, |
181 Name* key, | 196 Name* key, |
182 Map* target); | 197 Map* target); |
183 | 198 |
184 // Copy a single transition from the origin array. | 199 // Copy a single transition from the origin array. |
185 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, | 200 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, |
186 int origin_transition, | 201 int origin_transition, |
187 int target_transition); | 202 int target_transition); |
188 | 203 |
189 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); | 204 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); |
190 }; | 205 }; |
191 | 206 |
192 | 207 |
193 } } // namespace v8::internal | 208 } } // namespace v8::internal |
194 | 209 |
195 #endif // V8_TRANSITIONS_H_ | 210 #endif // V8_TRANSITIONS_H_ |
OLD | NEW |