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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // the original map. That way we can transition to the same map if the same | 95 // the original map. That way we can transition to the same map if the same |
96 // prototype is set, rather than creating a new map every time. The | 96 // prototype is set, rather than creating a new map every time. The |
97 // transitions are in the form of a map where the keys are prototype objects | 97 // transitions are in the form of a map where the keys are prototype objects |
98 // and the values are the maps they transition to. | 98 // and the values are the maps they transition to. |
99 // Cache format: | 99 // Cache format: |
100 // 0: finger - index of the first free cell in the cache | 100 // 0: finger - index of the first free cell in the cache |
101 // 1 + i: target map | 101 // 1 + i: target map |
102 static const int kMaxCachedPrototypeTransitions = 256; | 102 static const int kMaxCachedPrototypeTransitions = 256; |
103 static void PutPrototypeTransition(Handle<Map> map, Handle<Object> prototype, | 103 static void PutPrototypeTransition(Handle<Map> map, Handle<Object> prototype, |
104 Handle<Map> target_map); | 104 Handle<Map> target_map); |
| 105 static bool CompactPrototypeTransitionArray(FixedArray* array); |
| 106 static Handle<FixedArray> GrowPrototypeTransitionArray( |
| 107 Handle<FixedArray> array, int new_capacity, Isolate* isolate); |
105 | 108 |
106 static Handle<Map> GetPrototypeTransition(Handle<Map> map, | 109 static Handle<Map> GetPrototypeTransition(Handle<Map> map, |
107 Handle<Object> prototype); | 110 Handle<Object> prototype); |
108 | 111 |
109 static FixedArray* GetPrototypeTransitions(Map* map); | 112 static FixedArray* GetPrototypeTransitions(Map* map); |
110 | 113 |
111 static int NumberOfPrototypeTransitions(FixedArray* proto_transitions) { | 114 static int NumberOfPrototypeTransitions(FixedArray* proto_transitions) { |
112 if (proto_transitions->length() == 0) return 0; | 115 if (proto_transitions->length() == 0) return 0; |
113 Object* raw = proto_transitions->get(kProtoTransitionNumberOfEntriesOffset); | 116 Object* raw = proto_transitions->get(kProtoTransitionNumberOfEntriesOffset); |
114 return Smi::cast(raw)->value(); | 117 return Smi::cast(raw)->value(); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 #endif | 310 #endif |
308 | 311 |
309 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); | 312 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); |
310 }; | 313 }; |
311 | 314 |
312 | 315 |
313 } // namespace internal | 316 } // namespace internal |
314 } // namespace v8 | 317 } // namespace v8 |
315 | 318 |
316 #endif // V8_TRANSITIONS_H_ | 319 #endif // V8_TRANSITIONS_H_ |
OLD | NEW |