| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "vm/exceptions.h" | 7 #include "vm/exceptions.h" |
| 8 #include "vm/native_entry.h" | 8 #include "vm/native_entry.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); | 226 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); |
| 227 double value = static_cast<double>(self.w()); | 227 double value = static_cast<double>(self.w()); |
| 228 return Double::New(value); | 228 return Double::New(value); |
| 229 } | 229 } |
| 230 | 230 |
| 231 | 231 |
| 232 DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) { | 232 DEFINE_NATIVE_ENTRY(Float32x4_shuffle, 2) { |
| 233 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); | 233 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0)); |
| 234 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1)); | 234 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1)); |
| 235 int64_t m = mask.AsInt64Value(); | 235 int64_t m = mask.AsInt64Value(); |
| 236 if (m < 0 || m > 255) { |
| 237 const String& error = String::Handle( |
| 238 String::NewFormatted("mask (%"Pd64") must be in the range [0..256)", m)); |
| 239 const Array& args = Array::Handle(Array::New(1)); |
| 240 args.SetAt(0, error); |
| 241 Exceptions::ThrowByType(Exceptions::kRange, args); |
| 242 } |
| 236 float data[4] = { self.x(), self.y(), self.z(), self.w() }; | 243 float data[4] = { self.x(), self.y(), self.z(), self.w() }; |
| 237 float _x = data[m & 0x3]; | 244 float _x = data[m & 0x3]; |
| 238 float _y = data[(m >> 2) & 0x3]; | 245 float _y = data[(m >> 2) & 0x3]; |
| 239 float _z = data[(m >> 4) & 0x3]; | 246 float _z = data[(m >> 4) & 0x3]; |
| 240 float _w = data[(m >> 6) & 0x3]; | 247 float _w = data[(m >> 6) & 0x3]; |
| 241 return Float32x4::New(_x, _y, _z, _w); | 248 return Float32x4::New(_x, _y, _z, _w); |
| 242 } | 249 } |
| 243 | 250 |
| 244 | 251 |
| 245 DEFINE_NATIVE_ENTRY(Float32x4_withZWInXY, 2) { | 252 DEFINE_NATIVE_ENTRY(Float32x4_withZWInXY, 2) { |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 } | 659 } |
| 653 | 660 |
| 654 | 661 |
| 655 DEFINE_NATIVE_ENTRY(Uint32x4_toFloat32x4, 1) { | 662 DEFINE_NATIVE_ENTRY(Uint32x4_toFloat32x4, 1) { |
| 656 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, v, arguments->NativeArgAt(0)); | 663 GET_NON_NULL_NATIVE_ARGUMENT(Uint32x4, v, arguments->NativeArgAt(0)); |
| 657 return Float32x4::New(v.value()); | 664 return Float32x4::New(v.value()); |
| 658 } | 665 } |
| 659 | 666 |
| 660 | 667 |
| 661 } // namespace dart | 668 } // namespace dart |
| OLD | NEW |