OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 Object** TransitionArray::GetKeySlot(int transition_number) { | 137 Object** TransitionArray::GetKeySlot(int transition_number) { |
138 ASSERT(!IsSimpleTransition()); | 138 ASSERT(!IsSimpleTransition()); |
139 ASSERT(transition_number < number_of_transitions()); | 139 ASSERT(transition_number < number_of_transitions()); |
140 return HeapObject::RawField( | 140 return HeapObject::RawField( |
141 reinterpret_cast<HeapObject*>(this), | 141 reinterpret_cast<HeapObject*>(this), |
142 OffsetOfElementAt(ToKeyIndex(transition_number))); | 142 OffsetOfElementAt(ToKeyIndex(transition_number))); |
143 } | 143 } |
144 | 144 |
145 | 145 |
146 String* TransitionArray::GetKey(int transition_number) { | 146 Name* TransitionArray::GetKey(int transition_number) { |
147 if (IsSimpleTransition()) { | 147 if (IsSimpleTransition()) { |
148 Map* target = GetTarget(kSimpleTransitionIndex); | 148 Map* target = GetTarget(kSimpleTransitionIndex); |
149 int descriptor = target->LastAdded(); | 149 int descriptor = target->LastAdded(); |
150 String* key = target->instance_descriptors()->GetKey(descriptor); | 150 Name* key = target->instance_descriptors()->GetKey(descriptor); |
151 return key; | 151 return key; |
152 } | 152 } |
153 ASSERT(transition_number < number_of_transitions()); | 153 ASSERT(transition_number < number_of_transitions()); |
154 return String::cast(get(ToKeyIndex(transition_number))); | 154 return Name::cast(get(ToKeyIndex(transition_number))); |
155 } | 155 } |
156 | 156 |
157 | 157 |
158 void TransitionArray::SetKey(int transition_number, String* key) { | 158 void TransitionArray::SetKey(int transition_number, Name* key) { |
159 ASSERT(!IsSimpleTransition()); | 159 ASSERT(!IsSimpleTransition()); |
160 ASSERT(transition_number < number_of_transitions()); | 160 ASSERT(transition_number < number_of_transitions()); |
161 set(ToKeyIndex(transition_number), key); | 161 set(ToKeyIndex(transition_number), key); |
162 } | 162 } |
163 | 163 |
164 | 164 |
165 Map* TransitionArray::GetTarget(int transition_number) { | 165 Map* TransitionArray::GetTarget(int transition_number) { |
166 if (IsSimpleTransition()) { | 166 if (IsSimpleTransition()) { |
167 ASSERT(transition_number == kSimpleTransitionIndex); | 167 ASSERT(transition_number == kSimpleTransitionIndex); |
168 return Map::cast(get(kSimpleTransitionTarget)); | 168 return Map::cast(get(kSimpleTransitionTarget)); |
(...skipping 14 matching lines...) Expand all Loading... |
183 | 183 |
184 | 184 |
185 PropertyDetails TransitionArray::GetTargetDetails(int transition_number) { | 185 PropertyDetails TransitionArray::GetTargetDetails(int transition_number) { |
186 Map* map = GetTarget(transition_number); | 186 Map* map = GetTarget(transition_number); |
187 DescriptorArray* descriptors = map->instance_descriptors(); | 187 DescriptorArray* descriptors = map->instance_descriptors(); |
188 int descriptor = map->LastAdded(); | 188 int descriptor = map->LastAdded(); |
189 return descriptors->GetDetails(descriptor); | 189 return descriptors->GetDetails(descriptor); |
190 } | 190 } |
191 | 191 |
192 | 192 |
193 int TransitionArray::Search(String* name) { | 193 int TransitionArray::Search(Name* name) { |
194 if (IsSimpleTransition()) { | 194 if (IsSimpleTransition()) { |
195 String* key = GetKey(kSimpleTransitionIndex); | 195 Name* key = GetKey(kSimpleTransitionIndex); |
196 if (key->Equals(name)) return kSimpleTransitionIndex; | 196 if (key->Equals(name)) return kSimpleTransitionIndex; |
197 return kNotFound; | 197 return kNotFound; |
198 } | 198 } |
199 return internal::Search<ALL_ENTRIES>(this, name); | 199 return internal::Search<ALL_ENTRIES>(this, name); |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 void TransitionArray::NoIncrementalWriteBarrierSet(int transition_number, | 203 void TransitionArray::NoIncrementalWriteBarrierSet(int transition_number, |
204 String* key, | 204 Name* key, |
205 Map* target) { | 205 Map* target) { |
206 FixedArray::NoIncrementalWriteBarrierSet( | 206 FixedArray::NoIncrementalWriteBarrierSet( |
207 this, ToKeyIndex(transition_number), key); | 207 this, ToKeyIndex(transition_number), key); |
208 FixedArray::NoIncrementalWriteBarrierSet( | 208 FixedArray::NoIncrementalWriteBarrierSet( |
209 this, ToTargetIndex(transition_number), target); | 209 this, ToTargetIndex(transition_number), target); |
210 } | 210 } |
211 | 211 |
212 | 212 |
213 #undef FIELD_ADDR | 213 #undef FIELD_ADDR |
214 #undef WRITE_FIELD | 214 #undef WRITE_FIELD |
215 #undef CONDITIONAL_WRITE_BARRIER | 215 #undef CONDITIONAL_WRITE_BARRIER |
216 | 216 |
217 | 217 |
218 } } // namespace v8::internal | 218 } } // namespace v8::internal |
219 | 219 |
220 #endif // V8_TRANSITIONS_INL_H_ | 220 #endif // V8_TRANSITIONS_INL_H_ |
OLD | NEW |