OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 DEFINE_NATIVE_ENTRY(ByteArray_getUint64, 2) { | 244 DEFINE_NATIVE_ENTRY(ByteArray_getUint64, 2) { |
245 UNALIGNED_GETTER_UINT64(ByteArray); | 245 UNALIGNED_GETTER_UINT64(ByteArray); |
246 } | 246 } |
247 | 247 |
248 | 248 |
249 DEFINE_NATIVE_ENTRY(ByteArray_setUint64, 3) { | 249 DEFINE_NATIVE_ENTRY(ByteArray_setUint64, 3) { |
250 UNALIGNED_SETTER_UINT64(ByteArray); | 250 UNALIGNED_SETTER_UINT64(ByteArray); |
251 } | 251 } |
252 | 252 |
253 | 253 |
| 254 DEFINE_NATIVE_ENTRY(ByteArray_getFloat32x4, 2) { |
| 255 UNALIGNED_GETTER(ByteArray, Float32x4, simd_value_t); |
| 256 } |
| 257 |
| 258 |
| 259 DEFINE_NATIVE_ENTRY(ByteArray_setFloat32x4, 3) { |
| 260 UNALIGNED_SETTER(ByteArray, Float32x4, value, simd_value_t); |
| 261 } |
| 262 |
| 263 |
254 DEFINE_NATIVE_ENTRY(ByteArray_getFloat32, 2) { | 264 DEFINE_NATIVE_ENTRY(ByteArray_getFloat32, 2) { |
255 UNALIGNED_GETTER(ByteArray, Double, float); | 265 UNALIGNED_GETTER(ByteArray, Double, float); |
256 } | 266 } |
257 | 267 |
258 | 268 |
259 DEFINE_NATIVE_ENTRY(ByteArray_setFloat32, 3) { | 269 DEFINE_NATIVE_ENTRY(ByteArray_setFloat32, 3) { |
260 UNALIGNED_SETTER(ByteArray, Double, value, float); | 270 UNALIGNED_SETTER(ByteArray, Double, value, float); |
261 } | 271 } |
262 | 272 |
263 | 273 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 599 |
590 DEFINE_NATIVE_ENTRY(Uint64Array_getIndexed, 2) { | 600 DEFINE_NATIVE_ENTRY(Uint64Array_getIndexed, 2) { |
591 GETTER_UINT64(Uint64Array); | 601 GETTER_UINT64(Uint64Array); |
592 } | 602 } |
593 | 603 |
594 | 604 |
595 DEFINE_NATIVE_ENTRY(Uint64Array_setIndexed, 3) { | 605 DEFINE_NATIVE_ENTRY(Uint64Array_setIndexed, 3) { |
596 SETTER_UINT64(Uint64Array); | 606 SETTER_UINT64(Uint64Array); |
597 } | 607 } |
598 | 608 |
| 609 // Float32x4Array |
| 610 |
| 611 DEFINE_NATIVE_ENTRY(Float32x4Array_new, 1) { |
| 612 GET_NON_NULL_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(0)); |
| 613 intptr_t len = length.Value(); |
| 614 LengthCheck(len, Float32x4Array::kMaxElements); |
| 615 return Float32x4Array::New(len); |
| 616 } |
| 617 |
| 618 |
| 619 DEFINE_NATIVE_ENTRY(Float32x4List_newTransferable, 1) { |
| 620 const int kAlignment = 16; |
| 621 GET_NON_NULL_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(0)); |
| 622 intptr_t len = length.Value(); |
| 623 LengthCheck(len, Float32x4Array::kMaxElements); |
| 624 simd_value_t* bytes = OS::AllocateAlignedArray<simd_value_t>(len, kAlignment); |
| 625 const ExternalFloat32x4Array& obj = |
| 626 ExternalFloat32x4Array::Handle(ExternalFloat32x4Array::New(bytes, len)); |
| 627 obj.AddFinalizer(bytes, PeerFinalizer); |
| 628 return obj.raw(); |
| 629 } |
| 630 |
| 631 |
| 632 DEFINE_NATIVE_ENTRY(Float32x4Array_getIndexed, 2) { |
| 633 GETTER(Float32x4Array, Float32x4, simd_value_t); |
| 634 } |
| 635 |
| 636 |
| 637 DEFINE_NATIVE_ENTRY(Float32x4Array_setIndexed, 3) { |
| 638 SETTER(Float32x4Array, Float32x4, value, simd_value_t); |
| 639 } |
| 640 |
599 | 641 |
600 // Float32Array | 642 // Float32Array |
601 | 643 |
602 DEFINE_NATIVE_ENTRY(Float32Array_new, 1) { | 644 DEFINE_NATIVE_ENTRY(Float32Array_new, 1) { |
603 GET_NON_NULL_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(0)); | 645 GET_NON_NULL_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(0)); |
604 intptr_t len = length.Value(); | 646 intptr_t len = length.Value(); |
605 LengthCheck(len, Float32Array::kMaxElements); | 647 LengthCheck(len, Float32Array::kMaxElements); |
606 return Float32Array::New(len); | 648 return Float32Array::New(len); |
607 } | 649 } |
608 | 650 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 DEFINE_NATIVE_ENTRY(ExternalUint64Array_getIndexed, 2) { | 806 DEFINE_NATIVE_ENTRY(ExternalUint64Array_getIndexed, 2) { |
765 GETTER_UINT64(ExternalUint64Array); | 807 GETTER_UINT64(ExternalUint64Array); |
766 } | 808 } |
767 | 809 |
768 | 810 |
769 DEFINE_NATIVE_ENTRY(ExternalUint64Array_setIndexed, 3) { | 811 DEFINE_NATIVE_ENTRY(ExternalUint64Array_setIndexed, 3) { |
770 SETTER_UINT64(ExternalUint64Array); | 812 SETTER_UINT64(ExternalUint64Array); |
771 } | 813 } |
772 | 814 |
773 | 815 |
| 816 // ExternalFloat32x4Array |
| 817 |
| 818 DEFINE_NATIVE_ENTRY(ExternalFloat32x4Array_getIndexed, 2) { |
| 819 GETTER(ExternalFloat32x4Array, Float32x4, simd_value_t); |
| 820 } |
| 821 |
| 822 |
| 823 DEFINE_NATIVE_ENTRY(ExternalFloat32x4Array_setIndexed, 3) { |
| 824 SETTER(ExternalFloat32x4Array, Float32x4, value, simd_value_t); |
| 825 } |
| 826 |
| 827 |
774 // ExternalFloat32Array | 828 // ExternalFloat32Array |
775 | 829 |
776 DEFINE_NATIVE_ENTRY(ExternalFloat32Array_getIndexed, 2) { | 830 DEFINE_NATIVE_ENTRY(ExternalFloat32Array_getIndexed, 2) { |
777 GETTER(ExternalFloat32Array, Double, float); | 831 GETTER(ExternalFloat32Array, Double, float); |
778 } | 832 } |
779 | 833 |
780 | 834 |
781 DEFINE_NATIVE_ENTRY(ExternalFloat32Array_setIndexed, 3) { | 835 DEFINE_NATIVE_ENTRY(ExternalFloat32Array_setIndexed, 3) { |
782 SETTER(ExternalFloat32Array, Double, value, float); | 836 SETTER(ExternalFloat32Array, Double, value, float); |
783 } | 837 } |
784 | 838 |
785 | 839 |
786 // ExternalFloat64Array | 840 // ExternalFloat64Array |
787 | 841 |
788 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_getIndexed, 2) { | 842 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_getIndexed, 2) { |
789 GETTER(ExternalFloat64Array, Double, double); | 843 GETTER(ExternalFloat64Array, Double, double); |
790 } | 844 } |
791 | 845 |
792 | 846 |
793 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_setIndexed, 3) { | 847 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_setIndexed, 3) { |
794 SETTER(ExternalFloat64Array, Double, value, double); | 848 SETTER(ExternalFloat64Array, Double, value, double); |
795 } | 849 } |
796 | 850 |
797 } // namespace dart | 851 } // namespace dart |
OLD | NEW |