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" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 static void ThrowMaskRangeException(int64_t m) { | 14 static void ThrowMaskRangeException(int64_t m) { |
15 if ((m < 0) || (m > 255)) { | 15 if ((m < 0) || (m > 255)) { |
16 const String& error = String::Handle( | 16 Exceptions::ThrowRangeError( |
17 String::NewFormatted("mask (%" Pd64 ") must be in the range [0..256)", | 17 "mask", Integer::Handle(Integer::New(m)), 0, 256); |
18 m)); | |
19 const Array& args = Array::Handle(Array::New(1)); | |
20 args.SetAt(0, error); | |
21 Exceptions::ThrowByType(Exceptions::kRange, args); | |
22 } | 18 } |
23 } | 19 } |
24 | 20 |
25 | 21 |
26 DEFINE_NATIVE_ENTRY(Float32x4_fromDoubles, 5) { | 22 DEFINE_NATIVE_ENTRY(Float32x4_fromDoubles, 5) { |
27 ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); | 23 ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); |
28 GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(1)); | 24 GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(1)); |
29 GET_NON_NULL_NATIVE_ARGUMENT(Double, y, arguments->NativeArgAt(2)); | 25 GET_NON_NULL_NATIVE_ARGUMENT(Double, y, arguments->NativeArgAt(2)); |
30 GET_NON_NULL_NATIVE_ARGUMENT(Double, z, arguments->NativeArgAt(3)); | 26 GET_NON_NULL_NATIVE_ARGUMENT(Double, z, arguments->NativeArgAt(3)); |
31 GET_NON_NULL_NATIVE_ARGUMENT(Double, w, arguments->NativeArgAt(4)); | 27 GET_NON_NULL_NATIVE_ARGUMENT(Double, w, arguments->NativeArgAt(4)); |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 | 873 |
878 | 874 |
879 DEFINE_NATIVE_ENTRY(Float64x2_sqrt, 1) { | 875 DEFINE_NATIVE_ENTRY(Float64x2_sqrt, 1) { |
880 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); | 876 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0)); |
881 double _x = sqrt(self.x()); | 877 double _x = sqrt(self.x()); |
882 double _y = sqrt(self.y()); | 878 double _y = sqrt(self.y()); |
883 return Float64x2::New(_x, _y); | 879 return Float64x2::New(_x, _y); |
884 } | 880 } |
885 | 881 |
886 } // namespace dart | 882 } // namespace dart |
OLD | NEW |