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 #ifndef V8_ELEMENTS_KIND_H_ | 5 #ifndef V8_ELEMENTS_KIND_H_ |
6 #define V8_ELEMENTS_KIND_H_ | 6 #define V8_ELEMENTS_KIND_H_ |
7 | 7 |
8 #include "src/checks.h" | 8 #include "src/checks.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 10 matching lines...) Expand all Loading... |
21 // together at once. | 21 // together at once. |
22 FAST_ELEMENTS, | 22 FAST_ELEMENTS, |
23 FAST_HOLEY_ELEMENTS, | 23 FAST_HOLEY_ELEMENTS, |
24 | 24 |
25 // The "fast" kind for unwrapped, non-tagged double values. | 25 // The "fast" kind for unwrapped, non-tagged double values. |
26 FAST_DOUBLE_ELEMENTS, | 26 FAST_DOUBLE_ELEMENTS, |
27 FAST_HOLEY_DOUBLE_ELEMENTS, | 27 FAST_HOLEY_DOUBLE_ELEMENTS, |
28 | 28 |
29 // The "slow" kind. | 29 // The "slow" kind. |
30 DICTIONARY_ELEMENTS, | 30 DICTIONARY_ELEMENTS, |
31 SLOPPY_ARGUMENTS_ELEMENTS, | 31 |
| 32 FAST_SLOPPY_ARGUMENTS_ELEMENTS, |
| 33 SLOW_SLOPPY_ARGUMENTS_ELEMENTS, |
| 34 |
32 // The "fast" kind for external arrays | 35 // The "fast" kind for external arrays |
33 EXTERNAL_INT8_ELEMENTS, | 36 EXTERNAL_INT8_ELEMENTS, |
34 EXTERNAL_UINT8_ELEMENTS, | 37 EXTERNAL_UINT8_ELEMENTS, |
35 EXTERNAL_INT16_ELEMENTS, | 38 EXTERNAL_INT16_ELEMENTS, |
36 EXTERNAL_UINT16_ELEMENTS, | 39 EXTERNAL_UINT16_ELEMENTS, |
37 EXTERNAL_INT32_ELEMENTS, | 40 EXTERNAL_INT32_ELEMENTS, |
38 EXTERNAL_UINT32_ELEMENTS, | 41 EXTERNAL_UINT32_ELEMENTS, |
39 EXTERNAL_FLOAT32_ELEMENTS, | 42 EXTERNAL_FLOAT32_ELEMENTS, |
40 EXTERNAL_FLOAT64_ELEMENTS, | 43 EXTERNAL_FLOAT64_ELEMENTS, |
41 EXTERNAL_UINT8_CLAMPED_ELEMENTS, | 44 EXTERNAL_UINT8_CLAMPED_ELEMENTS, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind); | 84 int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind); |
82 | 85 |
83 ElementsKind GetNextTransitionElementsKind(ElementsKind elements_kind); | 86 ElementsKind GetNextTransitionElementsKind(ElementsKind elements_kind); |
84 | 87 |
85 inline bool IsDictionaryElementsKind(ElementsKind kind) { | 88 inline bool IsDictionaryElementsKind(ElementsKind kind) { |
86 return kind == DICTIONARY_ELEMENTS; | 89 return kind == DICTIONARY_ELEMENTS; |
87 } | 90 } |
88 | 91 |
89 | 92 |
90 inline bool IsSloppyArgumentsElements(ElementsKind kind) { | 93 inline bool IsSloppyArgumentsElements(ElementsKind kind) { |
91 return kind == SLOPPY_ARGUMENTS_ELEMENTS; | 94 return kind == FAST_SLOPPY_ARGUMENTS_ELEMENTS || |
| 95 kind == SLOW_SLOPPY_ARGUMENTS_ELEMENTS; |
92 } | 96 } |
93 | 97 |
94 | 98 |
95 inline bool IsExternalArrayElementsKind(ElementsKind kind) { | 99 inline bool IsExternalArrayElementsKind(ElementsKind kind) { |
96 return kind >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && | 100 return kind >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && |
97 kind <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND; | 101 kind <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND; |
98 } | 102 } |
99 | 103 |
100 | 104 |
101 inline bool IsTerminalElementsKind(ElementsKind kind) { | 105 inline bool IsTerminalElementsKind(ElementsKind kind) { |
102 return kind == TERMINAL_FAST_ELEMENTS_KIND || | 106 return kind == TERMINAL_FAST_ELEMENTS_KIND || |
103 IsExternalArrayElementsKind(kind); | 107 IsExternalArrayElementsKind(kind); |
104 } | 108 } |
105 | 109 |
106 | 110 |
107 inline bool IsFixedTypedArrayElementsKind(ElementsKind kind) { | 111 inline bool IsFixedTypedArrayElementsKind(ElementsKind kind) { |
108 return kind >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND && | 112 return kind >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND && |
109 kind <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND; | 113 kind <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND; |
110 } | 114 } |
111 | 115 |
112 | 116 |
113 inline bool IsFastElementsKind(ElementsKind kind) { | 117 inline bool IsFastElementsKind(ElementsKind kind) { |
114 DCHECK(FIRST_FAST_ELEMENTS_KIND == 0); | 118 DCHECK(FIRST_FAST_ELEMENTS_KIND == 0); |
115 return kind <= FAST_HOLEY_DOUBLE_ELEMENTS; | 119 return kind <= FAST_HOLEY_DOUBLE_ELEMENTS; |
116 } | 120 } |
117 | 121 |
118 | 122 |
119 inline bool IsTransitionElementsKind(ElementsKind kind) { | 123 inline bool IsTransitionElementsKind(ElementsKind kind) { |
120 return IsFastElementsKind(kind) || IsFixedTypedArrayElementsKind(kind); | 124 return IsFastElementsKind(kind) || IsFixedTypedArrayElementsKind(kind) || |
| 125 kind == FAST_SLOPPY_ARGUMENTS_ELEMENTS; |
121 } | 126 } |
122 | 127 |
123 | 128 |
124 inline bool IsFastDoubleElementsKind(ElementsKind kind) { | 129 inline bool IsFastDoubleElementsKind(ElementsKind kind) { |
125 return kind == FAST_DOUBLE_ELEMENTS || | 130 return kind == FAST_DOUBLE_ELEMENTS || |
126 kind == FAST_HOLEY_DOUBLE_ELEMENTS; | 131 kind == FAST_HOLEY_DOUBLE_ELEMENTS; |
127 } | 132 } |
128 | 133 |
129 | 134 |
130 inline bool IsExternalFloatOrDoubleElementsKind(ElementsKind kind) { | 135 inline bool IsExternalFloatOrDoubleElementsKind(ElementsKind kind) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, | 237 bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, |
233 ElementsKind to_kind); | 238 ElementsKind to_kind); |
234 | 239 |
235 | 240 |
236 inline bool IsTransitionableFastElementsKind(ElementsKind from_kind) { | 241 inline bool IsTransitionableFastElementsKind(ElementsKind from_kind) { |
237 return IsFastElementsKind(from_kind) && | 242 return IsFastElementsKind(from_kind) && |
238 from_kind != TERMINAL_FAST_ELEMENTS_KIND; | 243 from_kind != TERMINAL_FAST_ELEMENTS_KIND; |
239 } | 244 } |
240 | 245 |
241 | 246 |
242 ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, | |
243 bool allow_only_packed); | |
244 | |
245 | |
246 inline bool CanTransitionToMoreGeneralFastElementsKind( | |
247 ElementsKind elements_kind, | |
248 bool allow_only_packed) { | |
249 return IsFastElementsKind(elements_kind) && | |
250 (elements_kind != TERMINAL_FAST_ELEMENTS_KIND && | |
251 (!allow_only_packed || elements_kind != FAST_ELEMENTS)); | |
252 } | |
253 | |
254 | |
255 } } // namespace v8::internal | 247 } } // namespace v8::internal |
256 | 248 |
257 #endif // V8_ELEMENTS_KIND_H_ | 249 #endif // V8_ELEMENTS_KIND_H_ |
OLD | NEW |