OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/base/macros.h" | 8 #include "src/base/macros.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 // SIMD helper functions. | 158 // SIMD helper functions. |
159 | 159 |
160 RUNTIME_FUNCTION(Runtime_IsSimdValue) { | 160 RUNTIME_FUNCTION(Runtime_IsSimdValue) { |
161 HandleScope scope(isolate); | 161 HandleScope scope(isolate); |
162 DCHECK(args.length() == 1); | 162 DCHECK(args.length() == 1); |
163 return isolate->heap()->ToBoolean(args[0]->IsSimd128Value()); | 163 return isolate->heap()->ToBoolean(args[0]->IsSimd128Value()); |
164 } | 164 } |
165 | 165 |
166 | 166 |
167 RUNTIME_FUNCTION(Runtime_SimdSameValue) { | |
168 HandleScope scope(isolate); | |
169 DCHECK(args.length() == 2); | |
170 CONVERT_ARG_HANDLE_CHECKED(Simd128Value, a, 0); | |
171 bool result = false; | |
172 // args[1] is of unknown type. | |
173 if (args[1]->IsSimd128Value()) { | |
174 Simd128Value* b = Simd128Value::cast(args[1]); | |
175 if (a->map() == b->map()) { | |
176 if (a->IsFloat32x4()) { | |
177 result = Float32x4::cast(*a)->SameValue(Float32x4::cast(b)); | |
178 } else { | |
179 result = a->BitwiseEquals(b); | |
180 } | |
181 } | |
182 } | |
183 return isolate->heap()->ToBoolean(result); | |
184 } | |
185 | |
186 | |
187 RUNTIME_FUNCTION(Runtime_SimdSameValueZero) { | |
188 HandleScope scope(isolate); | |
189 DCHECK(args.length() == 2); | |
190 CONVERT_ARG_HANDLE_CHECKED(Simd128Value, a, 0); | |
191 bool result = false; | |
192 // args[1] is of unknown type. | |
193 if (args[1]->IsSimd128Value()) { | |
194 Simd128Value* b = Simd128Value::cast(args[1]); | |
195 if (a->map() == b->map()) { | |
196 if (a->IsFloat32x4()) { | |
197 result = Float32x4::cast(*a)->SameValueZero(Float32x4::cast(b)); | |
198 } else { | |
199 result = a->BitwiseEquals(b); | |
200 } | |
201 } | |
202 } | |
203 return isolate->heap()->ToBoolean(result); | |
204 } | |
205 | |
206 | |
207 //------------------------------------------------------------------- | 167 //------------------------------------------------------------------- |
208 | 168 |
209 // Utility macros. | 169 // Utility macros. |
210 | 170 |
211 #define CONVERT_SIMD_LANE_ARG_CHECKED(name, index, lanes) \ | 171 #define CONVERT_SIMD_LANE_ARG_CHECKED(name, index, lanes) \ |
212 CONVERT_INT32_ARG_CHECKED(name, index); \ | 172 CONVERT_INT32_ARG_CHECKED(name, index); \ |
213 RUNTIME_ASSERT(name >= 0 && name < lanes); | 173 RUNTIME_ASSERT(name >= 0 && name < lanes); |
214 | 174 |
215 #define CONVERT_SIMD_ARG_HANDLE_THROW(Type, name, index) \ | 175 #define CONVERT_SIMD_ARG_HANDLE_THROW(Type, name, index) \ |
216 Handle<Type> name; \ | 176 Handle<Type> name; \ |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 SIMD_LOADN_STOREN_TYPES(SIMD_LOAD3_FUNCTION) | 975 SIMD_LOADN_STOREN_TYPES(SIMD_LOAD3_FUNCTION) |
1016 SIMD_NUMERIC_TYPES(SIMD_STORE_FUNCTION) | 976 SIMD_NUMERIC_TYPES(SIMD_STORE_FUNCTION) |
1017 SIMD_LOADN_STOREN_TYPES(SIMD_STORE1_FUNCTION) | 977 SIMD_LOADN_STOREN_TYPES(SIMD_STORE1_FUNCTION) |
1018 SIMD_LOADN_STOREN_TYPES(SIMD_STORE2_FUNCTION) | 978 SIMD_LOADN_STOREN_TYPES(SIMD_STORE2_FUNCTION) |
1019 SIMD_LOADN_STOREN_TYPES(SIMD_STORE3_FUNCTION) | 979 SIMD_LOADN_STOREN_TYPES(SIMD_STORE3_FUNCTION) |
1020 | 980 |
1021 //------------------------------------------------------------------- | 981 //------------------------------------------------------------------- |
1022 | 982 |
1023 } // namespace internal | 983 } // namespace internal |
1024 } // namespace v8 | 984 } // namespace v8 |
OLD | NEW |