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_INL_H_ | 5 #ifndef V8_TRANSITIONS_INL_H_ |
6 #define V8_TRANSITIONS_INL_H_ | 6 #define V8_TRANSITIONS_INL_H_ |
7 | 7 |
8 #include "src/transitions.h" | 8 #include "src/transitions.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 29 matching lines...) Expand all Loading... |
40 return RawFieldOfElementAt(kPrototypeTransitionsIndex); | 40 return RawFieldOfElementAt(kPrototypeTransitionsIndex); |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 Object** TransitionArray::GetKeySlot(int transition_number) { | 44 Object** TransitionArray::GetKeySlot(int transition_number) { |
45 DCHECK(transition_number < number_of_transitions()); | 45 DCHECK(transition_number < number_of_transitions()); |
46 return RawFieldOfElementAt(ToKeyIndex(transition_number)); | 46 return RawFieldOfElementAt(ToKeyIndex(transition_number)); |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 Object** TransitionArray::GetTargetSlot(int transition_number) { | |
51 DCHECK(transition_number < number_of_transitions()); | |
52 return RawFieldOfElementAt(ToTargetIndex(transition_number)); | |
53 } | |
54 | |
55 | |
56 Name* TransitionArray::GetKey(int transition_number) { | 50 Name* TransitionArray::GetKey(int transition_number) { |
57 DCHECK(transition_number < number_of_transitions()); | 51 DCHECK(transition_number < number_of_transitions()); |
58 return Name::cast(get(ToKeyIndex(transition_number))); | 52 return Name::cast(get(ToKeyIndex(transition_number))); |
59 } | 53 } |
60 | 54 |
61 | 55 |
62 Name* TransitionArray::GetKey(Object* raw_transitions, int transition_number) { | 56 Name* TransitionArray::GetKey(Object* raw_transitions, int transition_number) { |
63 if (IsSimpleTransition(raw_transitions)) { | 57 if (IsSimpleTransition(raw_transitions)) { |
64 DCHECK(transition_number == 0); | 58 DCHECK(transition_number == 0); |
65 return GetSimpleTransitionKey(GetSimpleTransition(raw_transitions)); | 59 return GetSimpleTransitionKey(GetSimpleTransition(raw_transitions)); |
66 } | 60 } |
67 DCHECK(IsFullTransitionArray(raw_transitions)); | 61 DCHECK(IsFullTransitionArray(raw_transitions)); |
68 return TransitionArray::cast(raw_transitions)->GetKey(transition_number); | 62 return TransitionArray::cast(raw_transitions)->GetKey(transition_number); |
69 } | 63 } |
70 | 64 |
71 | 65 |
72 void TransitionArray::SetKey(int transition_number, Name* key) { | 66 void TransitionArray::SetKey(int transition_number, Name* key) { |
73 DCHECK(transition_number < number_of_transitions()); | 67 DCHECK(transition_number < number_of_transitions()); |
74 set(ToKeyIndex(transition_number), key); | 68 set(ToKeyIndex(transition_number), key); |
75 } | 69 } |
76 | 70 |
77 | 71 |
78 Map* TransitionArray::GetTarget(int transition_number) { | 72 Map* TransitionArray::GetTarget(int transition_number) { |
79 DCHECK(transition_number < number_of_transitions()); | 73 DCHECK(transition_number < number_of_transitions()); |
80 WeakCell* cell = GetTargetCell(transition_number); | 74 return Map::cast(get(ToTargetIndex(transition_number))); |
81 return Map::cast(cell->value()); | |
82 } | 75 } |
83 | 76 |
84 | 77 |
85 Map* TransitionArray::GetTarget(Object* raw_transitions, | 78 Map* TransitionArray::GetTarget(Object* raw_transitions, |
86 int transition_number) { | 79 int transition_number) { |
87 if (IsSimpleTransition(raw_transitions)) { | 80 if (IsSimpleTransition(raw_transitions)) { |
88 DCHECK(transition_number == 0); | 81 DCHECK(transition_number == 0); |
89 return GetSimpleTransition(raw_transitions); | 82 return GetSimpleTransition(raw_transitions); |
90 } | 83 } |
91 DCHECK(IsFullTransitionArray(raw_transitions)); | 84 DCHECK(IsFullTransitionArray(raw_transitions)); |
92 return TransitionArray::cast(raw_transitions)->GetTarget(transition_number); | 85 return TransitionArray::cast(raw_transitions)->GetTarget(transition_number); |
93 } | 86 } |
94 | 87 |
95 | 88 |
96 WeakCell* TransitionArray::GetTargetCell(int transition_number) { | 89 void TransitionArray::SetTarget(int transition_number, Map* value) { |
97 DCHECK(transition_number < number_of_transitions()); | |
98 return WeakCell::cast(get(ToTargetIndex(transition_number))); | |
99 } | |
100 | |
101 | |
102 void TransitionArray::SetTargetCell(int transition_number, WeakCell* value) { | |
103 DCHECK(transition_number < number_of_transitions()); | 90 DCHECK(transition_number < number_of_transitions()); |
104 set(ToTargetIndex(transition_number), value); | 91 set(ToTargetIndex(transition_number), value); |
105 } | 92 } |
106 | 93 |
107 | 94 |
108 int TransitionArray::SearchName(Name* name, int* out_insertion_index) { | 95 int TransitionArray::SearchName(Name* name, int* out_insertion_index) { |
109 return internal::Search<ALL_ENTRIES>(this, name, 0, out_insertion_index); | 96 return internal::Search<ALL_ENTRIES>(this, name, 0, out_insertion_index); |
110 } | 97 } |
111 | 98 |
112 | 99 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 PropertyDetails TransitionArray::GetTargetDetails(Name* name, Map* target) { | 151 PropertyDetails TransitionArray::GetTargetDetails(Name* name, Map* target) { |
165 DCHECK(!IsSpecialTransition(name)); | 152 DCHECK(!IsSpecialTransition(name)); |
166 int descriptor = target->LastAdded(); | 153 int descriptor = target->LastAdded(); |
167 DescriptorArray* descriptors = target->instance_descriptors(); | 154 DescriptorArray* descriptors = target->instance_descriptors(); |
168 // Transitions are allowed only for the last added property. | 155 // Transitions are allowed only for the last added property. |
169 DCHECK(descriptors->GetKey(descriptor)->Equals(name)); | 156 DCHECK(descriptors->GetKey(descriptor)->Equals(name)); |
170 return descriptors->GetDetails(descriptor); | 157 return descriptors->GetDetails(descriptor); |
171 } | 158 } |
172 | 159 |
173 | 160 |
174 void TransitionArray::Set(int transition_number, Name* key, WeakCell* target) { | 161 void TransitionArray::NoIncrementalWriteBarrierSet(int transition_number, |
175 set(ToKeyIndex(transition_number), key); | 162 Name* key, |
176 set(ToTargetIndex(transition_number), target); | 163 Map* target) { |
| 164 FixedArray::NoIncrementalWriteBarrierSet( |
| 165 this, ToKeyIndex(transition_number), key); |
| 166 FixedArray::NoIncrementalWriteBarrierSet( |
| 167 this, ToTargetIndex(transition_number), target); |
177 } | 168 } |
178 | 169 |
179 | 170 |
180 void TransitionArray::SetNumberOfTransitions(int number_of_transitions) { | 171 void TransitionArray::SetNumberOfTransitions(int number_of_transitions) { |
181 DCHECK(number_of_transitions <= Capacity(this)); | 172 DCHECK(number_of_transitions <= Capacity(this)); |
182 set(kTransitionLengthIndex, Smi::FromInt(number_of_transitions)); | 173 set(kTransitionLengthIndex, Smi::FromInt(number_of_transitions)); |
183 } | 174 } |
184 | 175 |
185 } } // namespace v8::internal | 176 } } // namespace v8::internal |
186 | 177 |
187 #endif // V8_TRANSITIONS_INL_H_ | 178 #endif // V8_TRANSITIONS_INL_H_ |
OLD | NEW |