| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 static Handle<Map> GetPrototypeTransition(Handle<Map> map, | 106 static Handle<Map> GetPrototypeTransition(Handle<Map> map, |
| 107 Handle<Object> prototype); | 107 Handle<Object> prototype); |
| 108 | 108 |
| 109 static FixedArray* GetPrototypeTransitions(Map* map); | 109 static FixedArray* GetPrototypeTransitions(Map* map); |
| 110 | 110 |
| 111 static int NumberOfPrototypeTransitions(FixedArray* proto_transitions) { | 111 static int NumberOfPrototypeTransitions(FixedArray* proto_transitions) { |
| 112 if (proto_transitions->length() == 0) return 0; | 112 if (proto_transitions->length() == 0) return 0; |
| 113 Object* raw = proto_transitions->get(kProtoTransitionNumberOfEntriesOffset); | 113 Object* raw = proto_transitions->get(kProtoTransitionNumberOfEntriesOffset); |
| 114 return Smi::cast(raw)->value(); | 114 return Smi::cast(raw)->value(); |
| 115 } | 115 } |
| 116 static int NumberOfPrototypeTransitionsForTest(Map* map); |
| 116 | 117 |
| 117 static void SetNumberOfPrototypeTransitions(FixedArray* proto_transitions, | 118 static void SetNumberOfPrototypeTransitions(FixedArray* proto_transitions, |
| 118 int value); | 119 int value); |
| 119 | 120 |
| 120 inline FixedArray* GetPrototypeTransitions(); | 121 inline FixedArray* GetPrototypeTransitions(); |
| 121 inline void SetPrototypeTransitions( | 122 inline void SetPrototypeTransitions( |
| 122 FixedArray* prototype_transitions, | 123 FixedArray* prototype_transitions, |
| 123 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 124 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 124 inline Object** GetPrototypeTransitionsSlot(); | 125 inline Object** GetPrototypeTransitionsSlot(); |
| 125 inline bool HasPrototypeTransitions(); | 126 inline bool HasPrototypeTransitions(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return transition->instance_descriptors()->GetKey(descriptor); | 266 return transition->instance_descriptors()->GetKey(descriptor); |
| 266 } | 267 } |
| 267 | 268 |
| 268 static void TraverseTransitionTreeInternal(Map* map, | 269 static void TraverseTransitionTreeInternal(Map* map, |
| 269 TraverseCallback callback, | 270 TraverseCallback callback, |
| 270 void* data); | 271 void* data); |
| 271 | 272 |
| 272 static void SetPrototypeTransitions(Handle<Map> map, | 273 static void SetPrototypeTransitions(Handle<Map> map, |
| 273 Handle<FixedArray> proto_transitions); | 274 Handle<FixedArray> proto_transitions); |
| 274 | 275 |
| 276 static bool CompactPrototypeTransitionArray(FixedArray* array); |
| 277 |
| 278 static Handle<FixedArray> GrowPrototypeTransitionArray( |
| 279 Handle<FixedArray> array, int new_capacity, Isolate* isolate); |
| 280 |
| 275 // Compares two tuples <key, kind, attributes>, returns -1 if | 281 // Compares two tuples <key, kind, attributes>, returns -1 if |
| 276 // tuple1 is "less" than tuple2, 0 if tuple1 equal to tuple2 and 1 otherwise. | 282 // tuple1 is "less" than tuple2, 0 if tuple1 equal to tuple2 and 1 otherwise. |
| 277 static inline int CompareKeys(Name* key1, uint32_t hash1, PropertyKind kind1, | 283 static inline int CompareKeys(Name* key1, uint32_t hash1, PropertyKind kind1, |
| 278 PropertyAttributes attributes1, Name* key2, | 284 PropertyAttributes attributes1, Name* key2, |
| 279 uint32_t hash2, PropertyKind kind2, | 285 uint32_t hash2, PropertyKind kind2, |
| 280 PropertyAttributes attributes2); | 286 PropertyAttributes attributes2); |
| 281 | 287 |
| 282 // Compares keys, returns -1 if key1 is "less" than key2, | 288 // Compares keys, returns -1 if key1 is "less" than key2, |
| 283 // 0 if key1 equal to key2 and 1 otherwise. | 289 // 0 if key1 equal to key2 and 1 otherwise. |
| 284 static inline int CompareNames(Name* key1, uint32_t hash1, Name* key2, | 290 static inline int CompareNames(Name* key1, uint32_t hash1, Name* key2, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 307 #endif | 313 #endif |
| 308 | 314 |
| 309 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); | 315 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); |
| 310 }; | 316 }; |
| 311 | 317 |
| 312 | 318 |
| 313 } // namespace internal | 319 } // namespace internal |
| 314 } // namespace v8 | 320 } // namespace v8 |
| 315 | 321 |
| 316 #endif // V8_TRANSITIONS_H_ | 322 #endif // V8_TRANSITIONS_H_ |
| OLD | NEW |