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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 for (int i = 0; i < kFastElementsKindCount; ++i) { | 135 for (int i = 0; i < kFastElementsKindCount; ++i) { |
136 if (fast_elements_kind_sequence.Get()[i] == elements_kind) { | 136 if (fast_elements_kind_sequence.Get()[i] == elements_kind) { |
137 return i; | 137 return i; |
138 } | 138 } |
139 } | 139 } |
140 UNREACHABLE(); | 140 UNREACHABLE(); |
141 return 0; | 141 return 0; |
142 } | 142 } |
143 | 143 |
144 | 144 |
145 ElementsKind GetNextTransitionElementsKind(ElementsKind kind) { | |
146 switch (kind) { | |
147 #define FIXED_TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | |
148 case TYPE##_ELEMENTS: return EXTERNAL_##TYPE##_ELEMENTS; | |
149 | |
150 TYPED_ARRAYS(FIXED_TYPED_ARRAY_CASE) | |
151 #undef FIXED_TYPED_ARRAY_CASE | |
152 default: { | |
153 int index = GetSequenceIndexFromFastElementsKind(kind); | |
154 return GetFastElementsKindFromSequenceIndex(index + 1); | |
155 } | |
156 } | |
157 } | |
158 | |
159 | |
160 ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, | 145 ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, |
161 bool allow_only_packed) { | 146 bool allow_only_packed) { |
162 ASSERT(IsFastElementsKind(elements_kind)); | 147 ASSERT(IsFastElementsKind(elements_kind)); |
163 ASSERT(elements_kind != TERMINAL_FAST_ELEMENTS_KIND); | 148 ASSERT(elements_kind != TERMINAL_FAST_ELEMENTS_KIND); |
164 while (true) { | 149 while (true) { |
165 elements_kind = GetNextTransitionElementsKind(elements_kind); | 150 int index = |
| 151 GetSequenceIndexFromFastElementsKind(elements_kind) + 1; |
| 152 elements_kind = GetFastElementsKindFromSequenceIndex(index); |
166 if (!IsFastHoleyElementsKind(elements_kind) || !allow_only_packed) { | 153 if (!IsFastHoleyElementsKind(elements_kind) || !allow_only_packed) { |
167 return elements_kind; | 154 return elements_kind; |
168 } | 155 } |
169 } | 156 } |
170 UNREACHABLE(); | 157 UNREACHABLE(); |
171 return TERMINAL_FAST_ELEMENTS_KIND; | 158 return TERMINAL_FAST_ELEMENTS_KIND; |
172 } | 159 } |
173 | 160 |
174 | 161 |
175 bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, | 162 bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, |
(...skipping 15 matching lines...) Expand all Loading... |
191 return to_kind == FAST_HOLEY_ELEMENTS; | 178 return to_kind == FAST_HOLEY_ELEMENTS; |
192 case FAST_HOLEY_ELEMENTS: | 179 case FAST_HOLEY_ELEMENTS: |
193 return false; | 180 return false; |
194 default: | 181 default: |
195 return false; | 182 return false; |
196 } | 183 } |
197 } | 184 } |
198 | 185 |
199 | 186 |
200 } } // namespace v8::internal | 187 } } // namespace v8::internal |
OLD | NEW |