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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 elements_kind = GetNextTransitionElementsKind(elements_kind); | 165 elements_kind = GetNextTransitionElementsKind(elements_kind); |
166 if (!IsFastHoleyElementsKind(elements_kind) || !allow_only_packed) { | 166 if (!IsFastHoleyElementsKind(elements_kind) || !allow_only_packed) { |
167 return elements_kind; | 167 return elements_kind; |
168 } | 168 } |
169 } | 169 } |
170 UNREACHABLE(); | 170 UNREACHABLE(); |
171 return TERMINAL_FAST_ELEMENTS_KIND; | 171 return TERMINAL_FAST_ELEMENTS_KIND; |
172 } | 172 } |
173 | 173 |
174 | 174 |
| 175 static bool IsTypedArrayElementsKind(ElementsKind elements_kind) { |
| 176 return IsFixedTypedArrayElementsKind(elements_kind) || |
| 177 IsExternalArrayElementsKind(elements_kind); |
| 178 } |
| 179 |
| 180 |
175 bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, | 181 bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, |
176 ElementsKind to_kind) { | 182 ElementsKind to_kind) { |
| 183 if (IsTypedArrayElementsKind(from_kind) || |
| 184 IsTypedArrayElementsKind(to_kind)) { |
| 185 switch (from_kind) { |
| 186 #define FIXED_TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
| 187 case TYPE##_ELEMENTS: \ |
| 188 return to_kind == EXTERNAL_##TYPE##_ELEMENTS; |
| 189 |
| 190 TYPED_ARRAYS(FIXED_TYPED_ARRAY_CASE); |
| 191 #undef FIXED_TYPED_ARRAY_CASE |
| 192 default: |
| 193 return false; |
| 194 } |
| 195 } |
177 switch (from_kind) { | 196 switch (from_kind) { |
178 case FAST_SMI_ELEMENTS: | 197 case FAST_SMI_ELEMENTS: |
179 return to_kind != FAST_SMI_ELEMENTS; | 198 return to_kind != FAST_SMI_ELEMENTS; |
180 case FAST_HOLEY_SMI_ELEMENTS: | 199 case FAST_HOLEY_SMI_ELEMENTS: |
181 return to_kind != FAST_SMI_ELEMENTS && | 200 return to_kind != FAST_SMI_ELEMENTS && |
182 to_kind != FAST_HOLEY_SMI_ELEMENTS; | 201 to_kind != FAST_HOLEY_SMI_ELEMENTS; |
183 case FAST_DOUBLE_ELEMENTS: | 202 case FAST_DOUBLE_ELEMENTS: |
184 return to_kind != FAST_SMI_ELEMENTS && | 203 return to_kind != FAST_SMI_ELEMENTS && |
185 to_kind != FAST_HOLEY_SMI_ELEMENTS && | 204 to_kind != FAST_HOLEY_SMI_ELEMENTS && |
186 to_kind != FAST_DOUBLE_ELEMENTS; | 205 to_kind != FAST_DOUBLE_ELEMENTS; |
187 case FAST_HOLEY_DOUBLE_ELEMENTS: | 206 case FAST_HOLEY_DOUBLE_ELEMENTS: |
188 return to_kind == FAST_ELEMENTS || | 207 return to_kind == FAST_ELEMENTS || |
189 to_kind == FAST_HOLEY_ELEMENTS; | 208 to_kind == FAST_HOLEY_ELEMENTS; |
190 case FAST_ELEMENTS: | 209 case FAST_ELEMENTS: |
191 return to_kind == FAST_HOLEY_ELEMENTS; | 210 return to_kind == FAST_HOLEY_ELEMENTS; |
192 case FAST_HOLEY_ELEMENTS: | 211 case FAST_HOLEY_ELEMENTS: |
193 return false; | 212 return false; |
194 default: | 213 default: |
195 return false; | 214 return false; |
196 } | 215 } |
197 } | 216 } |
198 | 217 |
199 | 218 |
200 } } // namespace v8::internal | 219 } } // namespace v8::internal |
OLD | NEW |