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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 Handle<Map> containing_map); | 91 Handle<Map> containing_map); |
92 | 92 |
93 // Return a transition array, using the array from the owning map if it | 93 // Return a transition array, using the array from the owning map if it |
94 // already has one (copying into a larger array if necessary), otherwise | 94 // already has one (copying into a larger array if necessary), otherwise |
95 // creating a new one according to flag. | 95 // creating a new one according to flag. |
96 // TODO(verwaest): This should not cause an existing transition to be | 96 // TODO(verwaest): This should not cause an existing transition to be |
97 // overwritten. | 97 // overwritten. |
98 static Handle<TransitionArray> Insert(Handle<Map> map, Handle<Name> name, | 98 static Handle<TransitionArray> Insert(Handle<Map> map, Handle<Name> name, |
99 Handle<Map> target, | 99 Handle<Map> target, |
100 SimpleTransitionFlag flag); | 100 SimpleTransitionFlag flag); |
101 // Search a transition for a given type, property name and attributes. | 101 // Search a transition for a given kind, property name and attributes. |
102 int Search(PropertyType type, Name* name, PropertyAttributes attributes, | 102 int Search(PropertyKind kind, Name* name, PropertyAttributes attributes, |
103 int* out_insertion_index = NULL); | 103 int* out_insertion_index = NULL); |
104 | 104 |
105 // Search a non-property transition (like elements kind, observe or frozen | 105 // Search a non-property transition (like elements kind, observe or frozen |
106 // transitions). | 106 // transitions). |
107 inline int SearchSpecial(Symbol* symbol, int* out_insertion_index = NULL) { | 107 inline int SearchSpecial(Symbol* symbol, int* out_insertion_index = NULL) { |
108 return SearchName(symbol, out_insertion_index); | 108 return SearchName(symbol, out_insertion_index); |
109 } | 109 } |
110 | 110 |
111 static inline PropertyDetails GetTargetDetails(Name* name, Map* target); | 111 static inline PropertyDetails GetTargetDetails(Name* name, Map* target); |
112 | 112 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 Isolate* isolate, Handle<Map> target); | 209 Isolate* isolate, Handle<Map> target); |
210 | 210 |
211 // Allocate a new transition array with a single entry. | 211 // Allocate a new transition array with a single entry. |
212 static Handle<TransitionArray> NewWith(Handle<Map> map, | 212 static Handle<TransitionArray> NewWith(Handle<Map> map, |
213 Handle<Name> name, | 213 Handle<Name> name, |
214 Handle<Map> target, | 214 Handle<Map> target, |
215 SimpleTransitionFlag flag); | 215 SimpleTransitionFlag flag); |
216 | 216 |
217 // Search a first transition for a given property name. | 217 // Search a first transition for a given property name. |
218 inline int SearchName(Name* name, int* out_insertion_index = NULL); | 218 inline int SearchName(Name* name, int* out_insertion_index = NULL); |
219 int SearchDetails(int transition, PropertyType type, | 219 int SearchDetails(int transition, PropertyKind kind, |
220 PropertyAttributes attributes, int* out_insertion_index); | 220 PropertyAttributes attributes, int* out_insertion_index); |
221 | 221 |
222 // Compares two tuples <key, is_data_property, attributes>, returns -1 if | 222 // Compares two tuples <key, kind, attributes>, returns -1 if |
223 // tuple1 is "less" than tuple2, 0 if tuple1 equal to tuple2 and 1 otherwise. | 223 // tuple1 is "less" than tuple2, 0 if tuple1 equal to tuple2 and 1 otherwise. |
224 static inline int CompareKeys(Name* key1, uint32_t hash1, | 224 static inline int CompareKeys(Name* key1, uint32_t hash1, PropertyKind kind1, |
225 bool is_data_property1, | |
226 PropertyAttributes attributes1, Name* key2, | 225 PropertyAttributes attributes1, Name* key2, |
227 uint32_t hash2, bool is_data_property2, | 226 uint32_t hash2, PropertyKind kind2, |
228 PropertyAttributes attributes2); | 227 PropertyAttributes attributes2); |
229 | 228 |
230 // Compares keys, returns -1 if key1 is "less" than key2, | 229 // Compares keys, returns -1 if key1 is "less" than key2, |
231 // 0 if key1 equal to key2 and 1 otherwise. | 230 // 0 if key1 equal to key2 and 1 otherwise. |
232 static inline int CompareNames(Name* key1, uint32_t hash1, Name* key2, | 231 static inline int CompareNames(Name* key1, uint32_t hash1, Name* key2, |
233 uint32_t hash2); | 232 uint32_t hash2); |
234 | 233 |
235 // Compares two details, returns -1 if details1 is "less" than details2, | 234 // Compares two details, returns -1 if details1 is "less" than details2, |
236 // 0 if details1 equal to details2 and 1 otherwise. | 235 // 0 if details1 equal to details2 and 1 otherwise. |
237 static inline int CompareDetails(bool is_data_property1, | 236 static inline int CompareDetails(PropertyKind kind1, |
238 PropertyAttributes attributes1, | 237 PropertyAttributes attributes1, |
239 bool is_data_property2, | 238 PropertyKind kind2, |
240 PropertyAttributes attributes2); | 239 PropertyAttributes attributes2); |
241 | 240 |
242 inline void NoIncrementalWriteBarrierSet(int transition_number, | 241 inline void NoIncrementalWriteBarrierSet(int transition_number, |
243 Name* key, | 242 Name* key, |
244 Map* target); | 243 Map* target); |
245 | 244 |
246 // Copy a single transition from the origin array. | 245 // Copy a single transition from the origin array. |
247 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, | 246 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, |
248 int origin_transition, | 247 int origin_transition, |
249 int target_transition); | 248 int target_transition); |
250 | 249 |
251 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); | 250 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); |
252 }; | 251 }; |
253 | 252 |
254 | 253 |
255 } } // namespace v8::internal | 254 } } // namespace v8::internal |
256 | 255 |
257 #endif // V8_TRANSITIONS_H_ | 256 #endif // V8_TRANSITIONS_H_ |
OLD | NEW |