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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 array->SetTarget(index, array->GetTarget(index - 1)); | 99 array->SetTarget(index, array->GetTarget(index - 1)); |
100 } | 100 } |
101 array->SetKey(index, *name); | 101 array->SetKey(index, *name); |
102 array->SetTarget(index, *target); | 102 array->SetTarget(index, *target); |
103 SLOW_DCHECK(array->IsSortedNoDuplicates()); | 103 SLOW_DCHECK(array->IsSortedNoDuplicates()); |
104 return; | 104 return; |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 // We're gonna need a bigger TransitionArray. | 108 // We're gonna need a bigger TransitionArray. |
109 Handle<TransitionArray> result = | 109 Handle<TransitionArray> result = Allocate( |
110 Allocate(map->GetIsolate(), new_nof, | 110 map->GetIsolate(), new_nof, |
111 Map::SlackForArraySize(false, number_of_transitions, | 111 Map::SlackForArraySize(number_of_transitions, kMaxNumberOfTransitions)); |
112 kMaxNumberOfTransitions)); | |
113 | 112 |
114 // The map's transition array may have shrunk during the allocation above as | 113 // The map's transition array may have shrunk during the allocation above as |
115 // it was weakly traversed, though it is guaranteed not to disappear. Trim the | 114 // it was weakly traversed, though it is guaranteed not to disappear. Trim the |
116 // result copy if needed, and recompute variables. | 115 // result copy if needed, and recompute variables. |
117 DCHECK(IsFullTransitionArray(map->raw_transitions())); | 116 DCHECK(IsFullTransitionArray(map->raw_transitions())); |
118 DisallowHeapAllocation no_gc; | 117 DisallowHeapAllocation no_gc; |
119 TransitionArray* array = TransitionArray::cast(map->raw_transitions()); | 118 TransitionArray* array = TransitionArray::cast(map->raw_transitions()); |
120 if (array->number_of_transitions() != number_of_transitions) { | 119 if (array->number_of_transitions() != number_of_transitions) { |
121 DCHECK(array->number_of_transitions() < number_of_transitions); | 120 DCHECK(array->number_of_transitions() < number_of_transitions); |
122 | 121 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 PropertyAttributes attributes, | 514 PropertyAttributes attributes, |
516 int* out_insertion_index) { | 515 int* out_insertion_index) { |
517 int transition = SearchName(name, out_insertion_index); | 516 int transition = SearchName(name, out_insertion_index); |
518 if (transition == kNotFound) { | 517 if (transition == kNotFound) { |
519 return kNotFound; | 518 return kNotFound; |
520 } | 519 } |
521 return SearchDetails(transition, kind, attributes, out_insertion_index); | 520 return SearchDetails(transition, kind, attributes, out_insertion_index); |
522 } | 521 } |
523 } // namespace internal | 522 } // namespace internal |
524 } // namespace v8 | 523 } // namespace v8 |
OLD | NEW |