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 |
145 ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, | 160 ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, |
146 bool allow_only_packed) { | 161 bool allow_only_packed) { |
147 ASSERT(IsFastElementsKind(elements_kind)); | 162 ASSERT(IsFastElementsKind(elements_kind)); |
148 ASSERT(elements_kind != TERMINAL_FAST_ELEMENTS_KIND); | 163 ASSERT(elements_kind != TERMINAL_FAST_ELEMENTS_KIND); |
149 while (true) { | 164 while (true) { |
150 int index = | 165 elements_kind = GetNextTransitionElementsKind(elements_kind); |
151 GetSequenceIndexFromFastElementsKind(elements_kind) + 1; | |
152 elements_kind = GetFastElementsKindFromSequenceIndex(index); | |
153 if (!IsFastHoleyElementsKind(elements_kind) || !allow_only_packed) { | 166 if (!IsFastHoleyElementsKind(elements_kind) || !allow_only_packed) { |
154 return elements_kind; | 167 return elements_kind; |
155 } | 168 } |
156 } | 169 } |
157 UNREACHABLE(); | 170 UNREACHABLE(); |
158 return TERMINAL_FAST_ELEMENTS_KIND; | 171 return TERMINAL_FAST_ELEMENTS_KIND; |
159 } | 172 } |
160 | 173 |
161 | 174 |
162 bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, | 175 bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, |
(...skipping 15 matching lines...) Expand all Loading... |
178 return to_kind == FAST_HOLEY_ELEMENTS; | 191 return to_kind == FAST_HOLEY_ELEMENTS; |
179 case FAST_HOLEY_ELEMENTS: | 192 case FAST_HOLEY_ELEMENTS: |
180 return false; | 193 return false; |
181 default: | 194 default: |
182 return false; | 195 return false; |
183 } | 196 } |
184 } | 197 } |
185 | 198 |
186 | 199 |
187 } } // namespace v8::internal | 200 } } // namespace v8::internal |
OLD | NEW |