| 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/base/macros.h" |
| 8 #include "src/checks.h" | 9 #include "src/checks.h" |
| 9 | 10 |
| 10 namespace v8 { | 11 namespace v8 { |
| 11 namespace internal { | 12 namespace internal { |
| 12 | 13 |
| 13 enum ElementsKind { | 14 enum ElementsKind { |
| 14 // The "fast" kind for elements that only contain SMI values. Must be first | 15 // The "fast" kind for elements that only contain SMI values. Must be first |
| 15 // to make it possible to efficiently check maps for this kind. | 16 // to make it possible to efficiently check maps for this kind. |
| 16 FAST_SMI_ELEMENTS, | 17 FAST_SMI_ELEMENTS, |
| 17 FAST_HOLEY_SMI_ELEMENTS, | 18 FAST_HOLEY_SMI_ELEMENTS, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 109 } |
| 109 | 110 |
| 110 | 111 |
| 111 inline bool IsFixedTypedArrayElementsKind(ElementsKind kind) { | 112 inline bool IsFixedTypedArrayElementsKind(ElementsKind kind) { |
| 112 return kind >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND && | 113 return kind >= FIRST_FIXED_TYPED_ARRAY_ELEMENTS_KIND && |
| 113 kind <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND; | 114 kind <= LAST_FIXED_TYPED_ARRAY_ELEMENTS_KIND; |
| 114 } | 115 } |
| 115 | 116 |
| 116 | 117 |
| 117 inline bool IsFastElementsKind(ElementsKind kind) { | 118 inline bool IsFastElementsKind(ElementsKind kind) { |
| 118 DCHECK(FIRST_FAST_ELEMENTS_KIND == 0); | 119 STATIC_ASSERT(FIRST_FAST_ELEMENTS_KIND == 0); |
| 119 return kind <= FAST_HOLEY_DOUBLE_ELEMENTS; | 120 return kind <= FAST_HOLEY_DOUBLE_ELEMENTS; |
| 120 } | 121 } |
| 121 | 122 |
| 122 | 123 |
| 123 inline bool IsTransitionElementsKind(ElementsKind kind) { | 124 inline bool IsTransitionElementsKind(ElementsKind kind) { |
| 124 return IsFastElementsKind(kind) || IsFixedTypedArrayElementsKind(kind) || | 125 return IsFastElementsKind(kind) || IsFixedTypedArrayElementsKind(kind) || |
| 125 kind == FAST_SLOPPY_ARGUMENTS_ELEMENTS; | 126 kind == FAST_SLOPPY_ARGUMENTS_ELEMENTS; |
| 126 } | 127 } |
| 127 | 128 |
| 128 | 129 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 241 |
| 241 inline bool IsTransitionableFastElementsKind(ElementsKind from_kind) { | 242 inline bool IsTransitionableFastElementsKind(ElementsKind from_kind) { |
| 242 return IsFastElementsKind(from_kind) && | 243 return IsFastElementsKind(from_kind) && |
| 243 from_kind != TERMINAL_FAST_ELEMENTS_KIND; | 244 from_kind != TERMINAL_FAST_ELEMENTS_KIND; |
| 244 } | 245 } |
| 245 | 246 |
| 246 | 247 |
| 247 } } // namespace v8::internal | 248 } } // namespace v8::internal |
| 248 | 249 |
| 249 #endif // V8_ELEMENTS_KIND_H_ | 250 #endif // V8_ELEMENTS_KIND_H_ |
| OLD | NEW |