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 #include "src/transitions.h" | 5 #include "src/transitions.h" |
6 | 6 |
7 #include "src/objects-inl.h" | 7 #include "src/objects-inl.h" |
8 #include "src/transitions-inl.h" | 8 #include "src/transitions-inl.h" |
9 #include "src/utils.h" | 9 #include "src/utils.h" |
10 | 10 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 // static | 196 // static |
197 Handle<Map> TransitionArray::FindTransitionToField(Handle<Map> map, | 197 Handle<Map> TransitionArray::FindTransitionToField(Handle<Map> map, |
198 Handle<Name> name) { | 198 Handle<Name> name) { |
199 DCHECK(name->IsUniqueName()); | 199 DCHECK(name->IsUniqueName()); |
200 DisallowHeapAllocation no_gc; | 200 DisallowHeapAllocation no_gc; |
201 Map* target = SearchTransition(*map, kData, *name, NONE); | 201 Map* target = SearchTransition(*map, kData, *name, NONE); |
202 if (target == NULL) return Handle<Map>::null(); | 202 if (target == NULL) return Handle<Map>::null(); |
203 PropertyDetails details = target->GetLastDescriptorDetails(); | 203 PropertyDetails details = target->GetLastDescriptorDetails(); |
204 DCHECK_EQ(NONE, details.attributes()); | 204 DCHECK_EQ(NONE, details.attributes()); |
205 if (details.type() != DATA) return Handle<Map>::null(); | 205 if (details.location() != kField) return Handle<Map>::null(); |
| 206 DCHECK_EQ(kData, details.kind()); |
206 return Handle<Map>(target); | 207 return Handle<Map>(target); |
207 } | 208 } |
208 | 209 |
209 | 210 |
210 // static | 211 // static |
211 Handle<String> TransitionArray::ExpectedTransitionKey(Handle<Map> map) { | 212 Handle<String> TransitionArray::ExpectedTransitionKey(Handle<Map> map) { |
212 DisallowHeapAllocation no_gc; | 213 DisallowHeapAllocation no_gc; |
213 Object* raw_transition = map->raw_transitions(); | 214 Object* raw_transition = map->raw_transitions(); |
214 if (!IsSimpleTransition(raw_transition)) return Handle<String>::null(); | 215 if (!IsSimpleTransition(raw_transition)) return Handle<String>::null(); |
215 Map* target = GetSimpleTransition(raw_transition); | 216 Map* target = GetSimpleTransition(raw_transition); |
216 PropertyDetails details = GetSimpleTargetDetails(target); | 217 PropertyDetails details = GetSimpleTargetDetails(target); |
217 if (details.type() != DATA) return Handle<String>::null(); | 218 if (details.location() != kField) return Handle<String>::null(); |
| 219 DCHECK_EQ(kData, details.kind()); |
218 if (details.attributes() != NONE) return Handle<String>::null(); | 220 if (details.attributes() != NONE) return Handle<String>::null(); |
219 Name* name = GetSimpleTransitionKey(target); | 221 Name* name = GetSimpleTransitionKey(target); |
220 if (!name->IsString()) return Handle<String>::null(); | 222 if (!name->IsString()) return Handle<String>::null(); |
221 return Handle<String>(String::cast(name)); | 223 return Handle<String>(String::cast(name)); |
222 } | 224 } |
223 | 225 |
224 | 226 |
225 // static | 227 // static |
226 bool TransitionArray::CanHaveMoreTransitions(Handle<Map> map) { | 228 bool TransitionArray::CanHaveMoreTransitions(Handle<Map> map) { |
227 if (map->is_dictionary_map()) return false; | 229 if (map->is_dictionary_map()) return false; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 546 |
545 int TransitionArray::Search(PropertyKind kind, Name* name, | 547 int TransitionArray::Search(PropertyKind kind, Name* name, |
546 PropertyAttributes attributes, | 548 PropertyAttributes attributes, |
547 int* out_insertion_index) { | 549 int* out_insertion_index) { |
548 int transition = SearchName(name, out_insertion_index); | 550 int transition = SearchName(name, out_insertion_index); |
549 if (transition == kNotFound) return kNotFound; | 551 if (transition == kNotFound) return kNotFound; |
550 return SearchDetails(transition, kind, attributes, out_insertion_index); | 552 return SearchDetails(transition, kind, attributes, out_insertion_index); |
551 } | 553 } |
552 } // namespace internal | 554 } // namespace internal |
553 } // namespace v8 | 555 } // namespace v8 |
OLD | NEW |