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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ? 0 : (FixedArray::kHeaderSize - kHeapObjectTag); | 58 ? 0 : (FixedArray::kHeaderSize - kHeapObjectTag); |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 const char* ElementsKindToString(ElementsKind kind) { | 62 const char* ElementsKindToString(ElementsKind kind) { |
63 ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); | 63 ElementsAccessor* accessor = ElementsAccessor::ForKind(kind); |
64 return accessor->name(); | 64 return accessor->name(); |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 ElementsKind GetInitialFastElementsKind() { | |
69 if (FLAG_packed_arrays) { | |
70 return FAST_SMI_ELEMENTS; | |
71 } else { | |
72 return FAST_HOLEY_SMI_ELEMENTS; | |
73 } | |
74 } | |
75 | |
76 | |
77 struct InitializeFastElementsKindSequence { | 68 struct InitializeFastElementsKindSequence { |
78 static void Construct( | 69 static void Construct( |
79 ElementsKind** fast_elements_kind_sequence_ptr) { | 70 ElementsKind** fast_elements_kind_sequence_ptr) { |
80 ElementsKind* fast_elements_kind_sequence = | 71 ElementsKind* fast_elements_kind_sequence = |
81 new ElementsKind[kFastElementsKindCount]; | 72 new ElementsKind[kFastElementsKindCount]; |
82 *fast_elements_kind_sequence_ptr = fast_elements_kind_sequence; | 73 *fast_elements_kind_sequence_ptr = fast_elements_kind_sequence; |
83 STATIC_ASSERT(FAST_SMI_ELEMENTS == FIRST_FAST_ELEMENTS_KIND); | 74 STATIC_ASSERT(FAST_SMI_ELEMENTS == FIRST_FAST_ELEMENTS_KIND); |
84 fast_elements_kind_sequence[0] = FAST_SMI_ELEMENTS; | 75 fast_elements_kind_sequence[0] = FAST_SMI_ELEMENTS; |
85 fast_elements_kind_sequence[1] = FAST_HOLEY_SMI_ELEMENTS; | 76 fast_elements_kind_sequence[1] = FAST_HOLEY_SMI_ELEMENTS; |
86 fast_elements_kind_sequence[2] = FAST_DOUBLE_ELEMENTS; | 77 fast_elements_kind_sequence[2] = FAST_DOUBLE_ELEMENTS; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 return false; | 189 return false; |
199 default: | 190 default: |
200 return false; | 191 return false; |
201 } | 192 } |
202 } | 193 } |
203 return false; | 194 return false; |
204 } | 195 } |
205 | 196 |
206 | 197 |
207 } } // namespace v8::internal | 198 } } // namespace v8::internal |
OLD | NEW |