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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/objects.h" | 7 #include "src/objects.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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 DCHECK(proto_transitions->length() != 0); | 309 DCHECK(proto_transitions->length() != 0); |
310 proto_transitions->set(kProtoTransitionNumberOfEntriesOffset, | 310 proto_transitions->set(kProtoTransitionNumberOfEntriesOffset, |
311 Smi::FromInt(value)); | 311 Smi::FromInt(value)); |
312 } | 312 } |
313 | 313 |
314 | 314 |
315 // static | 315 // static |
316 int TransitionArray::NumberOfTransitions(Object* raw_transitions) { | 316 int TransitionArray::NumberOfTransitions(Object* raw_transitions) { |
317 if (CanStoreSimpleTransition(raw_transitions)) return 0; | 317 if (CanStoreSimpleTransition(raw_transitions)) return 0; |
318 if (IsSimpleTransition(raw_transitions)) return 1; | 318 if (IsSimpleTransition(raw_transitions)) return 1; |
| 319 // Prototype maps don't have transitions. |
| 320 if (raw_transitions->IsPrototypeInfo()) return 0; |
319 DCHECK(IsFullTransitionArray(raw_transitions)); | 321 DCHECK(IsFullTransitionArray(raw_transitions)); |
320 return TransitionArray::cast(raw_transitions)->number_of_transitions(); | 322 return TransitionArray::cast(raw_transitions)->number_of_transitions(); |
321 } | 323 } |
322 | 324 |
323 | 325 |
324 // static | 326 // static |
325 int TransitionArray::Capacity(Object* raw_transitions) { | 327 int TransitionArray::Capacity(Object* raw_transitions) { |
326 if (!IsFullTransitionArray(raw_transitions)) return 1; | 328 if (!IsFullTransitionArray(raw_transitions)) return 1; |
327 TransitionArray* t = TransitionArray::cast(raw_transitions); | 329 TransitionArray* t = TransitionArray::cast(raw_transitions); |
328 if (t->length() <= kFirstIndex) return 0; | 330 if (t->length() <= kFirstIndex) return 0; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 int TransitionArray::Search(PropertyKind kind, Name* name, | 507 int TransitionArray::Search(PropertyKind kind, Name* name, |
506 PropertyAttributes attributes, | 508 PropertyAttributes attributes, |
507 int* out_insertion_index) { | 509 int* out_insertion_index) { |
508 int transition = SearchName(name, out_insertion_index); | 510 int transition = SearchName(name, out_insertion_index); |
509 if (transition == kNotFound) { | 511 if (transition == kNotFound) { |
510 return kNotFound; | 512 return kNotFound; |
511 } | 513 } |
512 return SearchDetails(transition, kind, attributes, out_insertion_index); | 514 return SearchDetails(transition, kind, attributes, out_insertion_index); |
513 } | 515 } |
514 } } // namespace v8::internal | 516 } } // namespace v8::internal |
OLD | NEW |