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 #include "src/elements-kind.h" | 5 #include "src/elements-kind.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/base/lazy-instance.h" | 8 #include "src/base/lazy-instance.h" |
9 #include "src/elements.h" | 9 #include "src/elements.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 case EXTERNAL_FLOAT64_ELEMENTS: | 37 case EXTERNAL_FLOAT64_ELEMENTS: |
38 case FAST_DOUBLE_ELEMENTS: | 38 case FAST_DOUBLE_ELEMENTS: |
39 case FAST_HOLEY_DOUBLE_ELEMENTS: | 39 case FAST_HOLEY_DOUBLE_ELEMENTS: |
40 case FLOAT64_ELEMENTS: | 40 case FLOAT64_ELEMENTS: |
41 return 3; | 41 return 3; |
42 case FAST_SMI_ELEMENTS: | 42 case FAST_SMI_ELEMENTS: |
43 case FAST_ELEMENTS: | 43 case FAST_ELEMENTS: |
44 case FAST_HOLEY_SMI_ELEMENTS: | 44 case FAST_HOLEY_SMI_ELEMENTS: |
45 case FAST_HOLEY_ELEMENTS: | 45 case FAST_HOLEY_ELEMENTS: |
46 case DICTIONARY_ELEMENTS: | 46 case DICTIONARY_ELEMENTS: |
47 case SLOPPY_ARGUMENTS_ELEMENTS: | 47 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 48 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
48 return kPointerSizeLog2; | 49 return kPointerSizeLog2; |
49 } | 50 } |
50 UNREACHABLE(); | 51 UNREACHABLE(); |
51 return 0; | 52 return 0; |
52 } | 53 } |
53 | 54 |
54 | 55 |
55 int GetDefaultHeaderSizeForElementsKind(ElementsKind elements_kind) { | 56 int GetDefaultHeaderSizeForElementsKind(ElementsKind elements_kind) { |
56 STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize); | 57 STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize); |
57 | 58 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 TYPED_ARRAYS(FIXED_TYPED_ARRAY_CASE) | 128 TYPED_ARRAYS(FIXED_TYPED_ARRAY_CASE) |
128 #undef FIXED_TYPED_ARRAY_CASE | 129 #undef FIXED_TYPED_ARRAY_CASE |
129 default: { | 130 default: { |
130 int index = GetSequenceIndexFromFastElementsKind(kind); | 131 int index = GetSequenceIndexFromFastElementsKind(kind); |
131 return GetFastElementsKindFromSequenceIndex(index + 1); | 132 return GetFastElementsKindFromSequenceIndex(index + 1); |
132 } | 133 } |
133 } | 134 } |
134 } | 135 } |
135 | 136 |
136 | 137 |
137 ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, | |
138 bool allow_only_packed) { | |
139 DCHECK(IsFastElementsKind(elements_kind)); | |
140 DCHECK(elements_kind != TERMINAL_FAST_ELEMENTS_KIND); | |
141 while (true) { | |
142 elements_kind = GetNextTransitionElementsKind(elements_kind); | |
143 if (!IsFastHoleyElementsKind(elements_kind) || !allow_only_packed) { | |
144 return elements_kind; | |
145 } | |
146 } | |
147 UNREACHABLE(); | |
148 return TERMINAL_FAST_ELEMENTS_KIND; | |
149 } | |
150 | |
151 | |
152 static bool IsTypedArrayElementsKind(ElementsKind elements_kind) { | 138 static bool IsTypedArrayElementsKind(ElementsKind elements_kind) { |
153 return IsFixedTypedArrayElementsKind(elements_kind) || | 139 return IsFixedTypedArrayElementsKind(elements_kind) || |
154 IsExternalArrayElementsKind(elements_kind); | 140 IsExternalArrayElementsKind(elements_kind); |
155 } | 141 } |
156 | 142 |
157 | 143 |
158 static inline bool IsFastTransitionTarget(ElementsKind elements_kind) { | 144 static inline bool IsFastTransitionTarget(ElementsKind elements_kind) { |
159 return IsFastElementsKind(elements_kind) || | 145 return IsFastElementsKind(elements_kind) || |
160 elements_kind == DICTIONARY_ELEMENTS; | 146 elements_kind == DICTIONARY_ELEMENTS; |
161 } | 147 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 default: | 182 default: |
197 return false; | 183 return false; |
198 } | 184 } |
199 } | 185 } |
200 return false; | 186 return false; |
201 } | 187 } |
202 | 188 |
203 | 189 |
204 } // namespace internal | 190 } // namespace internal |
205 } // namespace v8 | 191 } // namespace v8 |
OLD | NEW |