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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 }; | 90 }; |
91 | 91 |
92 | 92 |
93 static base::LazyInstance<ElementsKind*, | 93 static base::LazyInstance<ElementsKind*, |
94 InitializeFastElementsKindSequence>::type | 94 InitializeFastElementsKindSequence>::type |
95 fast_elements_kind_sequence = LAZY_INSTANCE_INITIALIZER; | 95 fast_elements_kind_sequence = LAZY_INSTANCE_INITIALIZER; |
96 | 96 |
97 | 97 |
98 ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_number) { | 98 ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_number) { |
99 ASSERT(sequence_number >= 0 && | 99 DCHECK(sequence_number >= 0 && |
100 sequence_number < kFastElementsKindCount); | 100 sequence_number < kFastElementsKindCount); |
101 return fast_elements_kind_sequence.Get()[sequence_number]; | 101 return fast_elements_kind_sequence.Get()[sequence_number]; |
102 } | 102 } |
103 | 103 |
104 | 104 |
105 int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind) { | 105 int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind) { |
106 for (int i = 0; i < kFastElementsKindCount; ++i) { | 106 for (int i = 0; i < kFastElementsKindCount; ++i) { |
107 if (fast_elements_kind_sequence.Get()[i] == elements_kind) { | 107 if (fast_elements_kind_sequence.Get()[i] == elements_kind) { |
108 return i; | 108 return i; |
109 } | 109 } |
(...skipping 13 matching lines...) Expand all Loading... |
123 default: { | 123 default: { |
124 int index = GetSequenceIndexFromFastElementsKind(kind); | 124 int index = GetSequenceIndexFromFastElementsKind(kind); |
125 return GetFastElementsKindFromSequenceIndex(index + 1); | 125 return GetFastElementsKindFromSequenceIndex(index + 1); |
126 } | 126 } |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 | 130 |
131 ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, | 131 ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, |
132 bool allow_only_packed) { | 132 bool allow_only_packed) { |
133 ASSERT(IsFastElementsKind(elements_kind)); | 133 DCHECK(IsFastElementsKind(elements_kind)); |
134 ASSERT(elements_kind != TERMINAL_FAST_ELEMENTS_KIND); | 134 DCHECK(elements_kind != TERMINAL_FAST_ELEMENTS_KIND); |
135 while (true) { | 135 while (true) { |
136 elements_kind = GetNextTransitionElementsKind(elements_kind); | 136 elements_kind = GetNextTransitionElementsKind(elements_kind); |
137 if (!IsFastHoleyElementsKind(elements_kind) || !allow_only_packed) { | 137 if (!IsFastHoleyElementsKind(elements_kind) || !allow_only_packed) { |
138 return elements_kind; | 138 return elements_kind; |
139 } | 139 } |
140 } | 140 } |
141 UNREACHABLE(); | 141 UNREACHABLE(); |
142 return TERMINAL_FAST_ELEMENTS_KIND; | 142 return TERMINAL_FAST_ELEMENTS_KIND; |
143 } | 143 } |
144 | 144 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 return false; | 189 return false; |
190 default: | 190 default: |
191 return false; | 191 return false; |
192 } | 192 } |
193 } | 193 } |
194 return false; | 194 return false; |
195 } | 195 } |
196 | 196 |
197 | 197 |
198 } } // namespace v8::internal | 198 } } // namespace v8::internal |
OLD | NEW |