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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // The number to add to a packed elements kind to reach a holey elements kind | 93 // The number to add to a packed elements kind to reach a holey elements kind |
94 const int kFastElementsKindPackedToHoley = | 94 const int kFastElementsKindPackedToHoley = |
95 FAST_HOLEY_SMI_ELEMENTS - FAST_SMI_ELEMENTS; | 95 FAST_HOLEY_SMI_ELEMENTS - FAST_SMI_ELEMENTS; |
96 | 96 |
97 int ElementsKindToShiftSize(ElementsKind elements_kind); | 97 int ElementsKindToShiftSize(ElementsKind elements_kind); |
98 const char* ElementsKindToString(ElementsKind kind); | 98 const char* ElementsKindToString(ElementsKind kind); |
99 void PrintElementsKind(FILE* out, ElementsKind kind); | 99 void PrintElementsKind(FILE* out, ElementsKind kind); |
100 | 100 |
101 ElementsKind GetInitialFastElementsKind(); | 101 ElementsKind GetInitialFastElementsKind(); |
102 | 102 |
103 ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_number); | 103 ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_index); |
| 104 |
104 int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind); | 105 int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind); |
105 | 106 |
106 ElementsKind GetNextTransitionElementsKind(ElementsKind elements_kind); | |
107 | 107 |
108 inline bool IsDictionaryElementsKind(ElementsKind kind) { | 108 inline bool IsDictionaryElementsKind(ElementsKind kind) { |
109 return kind == DICTIONARY_ELEMENTS; | 109 return kind == DICTIONARY_ELEMENTS; |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 inline bool IsExternalArrayElementsKind(ElementsKind kind) { | 113 inline bool IsExternalArrayElementsKind(ElementsKind kind) { |
114 return kind >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && | 114 return kind >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && |
115 kind <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND; | 115 kind <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND; |
116 } | 116 } |
117 | 117 |
118 | 118 |
119 inline bool IsTerminalElementsKind(ElementsKind kind) { | |
120 return kind == TERMINAL_FAST_ELEMENTS_KIND || | |
121 IsExternalArrayElementsKind(kind); | |
122 } | |
123 | |
124 | |
125 inline bool IsFixedTypedArrayElementsKind(ElementsKind kind) { | 119 inline bool IsFixedTypedArrayElementsKind(ElementsKind kind) { |
126 return kind >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND && | 120 return kind >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND && |
127 kind <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND; | 121 kind <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND; |
128 } | 122 } |
129 | 123 |
130 | 124 |
131 inline bool IsFastElementsKind(ElementsKind kind) { | 125 inline bool IsFastElementsKind(ElementsKind kind) { |
132 ASSERT(FIRST_FAST_ELEMENTS_KIND == 0); | 126 ASSERT(FIRST_FAST_ELEMENTS_KIND == 0); |
133 return kind <= FAST_HOLEY_DOUBLE_ELEMENTS; | 127 return kind <= FAST_HOLEY_DOUBLE_ELEMENTS; |
134 } | 128 } |
135 | 129 |
136 | 130 |
137 inline bool IsTransitionElementsKind(ElementsKind kind) { | |
138 return IsFastElementsKind(kind) || IsFixedTypedArrayElementsKind(kind); | |
139 } | |
140 | |
141 | |
142 inline bool IsFastDoubleElementsKind(ElementsKind kind) { | 131 inline bool IsFastDoubleElementsKind(ElementsKind kind) { |
143 return kind == FAST_DOUBLE_ELEMENTS || | 132 return kind == FAST_DOUBLE_ELEMENTS || |
144 kind == FAST_HOLEY_DOUBLE_ELEMENTS; | 133 kind == FAST_HOLEY_DOUBLE_ELEMENTS; |
145 } | 134 } |
146 | 135 |
147 | 136 |
148 inline bool IsExternalFloatOrDoubleElementsKind(ElementsKind kind) { | 137 inline bool IsExternalFloatOrDoubleElementsKind(ElementsKind kind) { |
149 return kind == EXTERNAL_FLOAT64_ELEMENTS || | 138 return kind == EXTERNAL_FLOAT64_ELEMENTS || |
150 kind == EXTERNAL_FLOAT32_ELEMENTS; | 139 kind == EXTERNAL_FLOAT32_ELEMENTS; |
151 } | 140 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 bool allow_only_packed) { | 255 bool allow_only_packed) { |
267 return IsFastElementsKind(elements_kind) && | 256 return IsFastElementsKind(elements_kind) && |
268 (elements_kind != TERMINAL_FAST_ELEMENTS_KIND && | 257 (elements_kind != TERMINAL_FAST_ELEMENTS_KIND && |
269 (!allow_only_packed || elements_kind != FAST_ELEMENTS)); | 258 (!allow_only_packed || elements_kind != FAST_ELEMENTS)); |
270 } | 259 } |
271 | 260 |
272 | 261 |
273 } } // namespace v8::internal | 262 } } // namespace v8::internal |
274 | 263 |
275 #endif // V8_ELEMENTS_KIND_H_ | 264 #endif // V8_ELEMENTS_KIND_H_ |
OLD | NEW |