| 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/assembler.h" | 5 #include "src/assembler.h" |
| 6 #include "src/codegen.h" | 6 #include "src/codegen.h" |
| 7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
| 8 #include "src/compiler/machine-type.h" | 8 #include "src/compiler/machine-type.h" |
| 9 #include "src/compiler/raw-machine-assembler.h" | 9 #include "src/compiler/raw-machine-assembler.h" |
| 10 #include "src/register-configuration.h" | 10 #include "src/register-configuration.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 int counter_; | 79 int counter_; |
| 80 bool exhaustive() { return max_pairs_ == (range_ * range_); } | 80 bool exhaustive() { return max_pairs_ == (range_ * range_); } |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 | 83 |
| 84 // Pairs of general purpose registers. | 84 // Pairs of general purpose registers. |
| 85 class RegisterPairs : public Pairs { | 85 class RegisterPairs : public Pairs { |
| 86 public: | 86 public: |
| 87 RegisterPairs() | 87 RegisterPairs() |
| 88 : Pairs( | 88 : Pairs( |
| 89 100, RegisterConfiguration::ArchDefault() | 89 100, |
| 90 ->num_allocatable_general_registers(), | 90 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 91 RegisterConfiguration::ArchDefault()->allocatable_general_codes()) { | 91 ->num_allocatable_general_registers(), |
| 92 } | 92 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 93 ->allocatable_general_codes()) {} |
| 93 }; | 94 }; |
| 94 | 95 |
| 95 | 96 |
| 96 // Pairs of double registers. | 97 // Pairs of double registers. |
| 97 class Float32RegisterPairs : public Pairs { | 98 class Float32RegisterPairs : public Pairs { |
| 98 public: | 99 public: |
| 99 Float32RegisterPairs() | 100 Float32RegisterPairs() |
| 100 : Pairs( | 101 : Pairs( |
| 101 100, RegisterConfiguration::ArchDefault() | 102 100, |
| 102 ->num_allocatable_aliased_double_registers(), | 103 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 103 RegisterConfiguration::ArchDefault()->allocatable_double_codes()) {} | 104 ->num_allocatable_aliased_double_registers(), |
| 105 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 106 ->allocatable_double_codes()) {} |
| 104 }; | 107 }; |
| 105 | 108 |
| 106 | 109 |
| 107 // Pairs of double registers. | 110 // Pairs of double registers. |
| 108 class Float64RegisterPairs : public Pairs { | 111 class Float64RegisterPairs : public Pairs { |
| 109 public: | 112 public: |
| 110 Float64RegisterPairs() | 113 Float64RegisterPairs() |
| 111 : Pairs( | 114 : Pairs( |
| 112 100, RegisterConfiguration::ArchDefault() | 115 100, |
| 113 ->num_allocatable_aliased_double_registers(), | 116 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 114 RegisterConfiguration::ArchDefault()->allocatable_double_codes()) {} | 117 ->num_allocatable_aliased_double_registers(), |
| 118 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 119 ->allocatable_double_codes()) {} |
| 115 }; | 120 }; |
| 116 | 121 |
| 117 | 122 |
| 118 // Helper for allocating either an GP or FP reg, or the next stack slot. | 123 // Helper for allocating either an GP or FP reg, or the next stack slot. |
| 119 struct Allocator { | 124 struct Allocator { |
| 120 Allocator(int* gp, int gpc, int* fp, int fpc) | 125 Allocator(int* gp, int gpc, int* fp, int fpc) |
| 121 : gp_count(gpc), | 126 : gp_count(gpc), |
| 122 gp_offset(0), | 127 gp_offset(0), |
| 123 gp_regs(gp), | 128 gp_regs(gp), |
| 124 fp_count(fpc), | 129 fp_count(fpc), |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 688 |
| 684 | 689 |
| 685 TEST(Run_CopyTwentyInt32_all_allocatable_pairs) { | 690 TEST(Run_CopyTwentyInt32_all_allocatable_pairs) { |
| 686 if (DISABLE_NATIVE_STACK_PARAMS) return; | 691 if (DISABLE_NATIVE_STACK_PARAMS) return; |
| 687 Int32Signature sig(20); | 692 Int32Signature sig(20); |
| 688 RegisterPairs pairs; | 693 RegisterPairs pairs; |
| 689 while (pairs.More()) { | 694 while (pairs.More()) { |
| 690 Zone zone; | 695 Zone zone; |
| 691 int parray[2]; | 696 int parray[2]; |
| 692 int rarray[] = { | 697 int rarray[] = { |
| 693 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)}; | 698 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 699 ->GetAllocatableGeneralCode(0)}; |
| 694 pairs.Next(&parray[0], &parray[1], false); | 700 pairs.Next(&parray[0], &parray[1], false); |
| 695 Allocator params(parray, 2, nullptr, 0); | 701 Allocator params(parray, 2, nullptr, 0); |
| 696 Allocator rets(rarray, 1, nullptr, 0); | 702 Allocator rets(rarray, 1, nullptr, 0); |
| 697 RegisterConfig config(params, rets); | 703 RegisterConfig config(params, rets); |
| 698 CallDescriptor* desc = config.Create(&zone, &sig); | 704 CallDescriptor* desc = config.Create(&zone, &sig); |
| 699 CopyTwentyInt32(desc); | 705 CopyTwentyInt32(desc); |
| 700 } | 706 } |
| 701 } | 707 } |
| 702 | 708 |
| 703 | 709 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 | 742 |
| 737 static void Test_Int32_WeightedSum_of_size(int count) { | 743 static void Test_Int32_WeightedSum_of_size(int count) { |
| 738 if (DISABLE_NATIVE_STACK_PARAMS) return; | 744 if (DISABLE_NATIVE_STACK_PARAMS) return; |
| 739 Int32Signature sig(count); | 745 Int32Signature sig(count); |
| 740 for (int p0 = 0; p0 < Register::kNumRegisters; p0++) { | 746 for (int p0 = 0; p0 < Register::kNumRegisters; p0++) { |
| 741 if (Register::from_code(p0).IsAllocatable()) { | 747 if (Register::from_code(p0).IsAllocatable()) { |
| 742 Zone zone; | 748 Zone zone; |
| 743 | 749 |
| 744 int parray[] = {p0}; | 750 int parray[] = {p0}; |
| 745 int rarray[] = { | 751 int rarray[] = { |
| 746 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)}; | 752 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 753 ->GetAllocatableGeneralCode(0)}; |
| 747 Allocator params(parray, 1, nullptr, 0); | 754 Allocator params(parray, 1, nullptr, 0); |
| 748 Allocator rets(rarray, 1, nullptr, 0); | 755 Allocator rets(rarray, 1, nullptr, 0); |
| 749 RegisterConfig config(params, rets); | 756 RegisterConfig config(params, rets); |
| 750 CallDescriptor* desc = config.Create(&zone, &sig); | 757 CallDescriptor* desc = config.Create(&zone, &sig); |
| 751 Run_Computation<int32_t>(desc, Build_Int32_WeightedSum, | 758 Run_Computation<int32_t>(desc, Build_Int32_WeightedSum, |
| 752 Compute_Int32_WeightedSum, 257 + count); | 759 Compute_Int32_WeightedSum, 257 + count); |
| 753 } | 760 } |
| 754 } | 761 } |
| 755 } | 762 } |
| 756 | 763 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 Compute_Select<CType, which>, | 799 Compute_Select<CType, which>, |
| 793 1044 + which + 3 * sizeof(CType)); | 800 1044 + which + 3 * sizeof(CType)); |
| 794 } | 801 } |
| 795 | 802 |
| 796 | 803 |
| 797 template <int which> | 804 template <int which> |
| 798 void Test_Int32_Select() { | 805 void Test_Int32_Select() { |
| 799 if (DISABLE_NATIVE_STACK_PARAMS) return; | 806 if (DISABLE_NATIVE_STACK_PARAMS) return; |
| 800 | 807 |
| 801 int parray[] = { | 808 int parray[] = { |
| 802 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)}; | 809 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 810 ->GetAllocatableGeneralCode(0)}; |
| 803 int rarray[] = { | 811 int rarray[] = { |
| 804 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)}; | 812 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 813 ->GetAllocatableGeneralCode(0)}; |
| 805 Allocator params(parray, 1, nullptr, 0); | 814 Allocator params(parray, 1, nullptr, 0); |
| 806 Allocator rets(rarray, 1, nullptr, 0); | 815 Allocator rets(rarray, 1, nullptr, 0); |
| 807 RegisterConfig config(params, rets); | 816 RegisterConfig config(params, rets); |
| 808 | 817 |
| 809 Zone zone; | 818 Zone zone; |
| 810 | 819 |
| 811 for (int i = which + 1; i <= 64; i++) { | 820 for (int i = which + 1; i <= 64; i++) { |
| 812 Int32Signature sig(i); | 821 Int32Signature sig(i); |
| 813 CallDescriptor* desc = config.Create(&zone, &sig); | 822 CallDescriptor* desc = config.Create(&zone, &sig); |
| 814 RunSelect<int32_t, which>(desc); | 823 RunSelect<int32_t, which>(desc); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 830 TEST_INT32_SELECT(6) | 839 TEST_INT32_SELECT(6) |
| 831 TEST_INT32_SELECT(11) | 840 TEST_INT32_SELECT(11) |
| 832 TEST_INT32_SELECT(15) | 841 TEST_INT32_SELECT(15) |
| 833 TEST_INT32_SELECT(19) | 842 TEST_INT32_SELECT(19) |
| 834 TEST_INT32_SELECT(45) | 843 TEST_INT32_SELECT(45) |
| 835 TEST_INT32_SELECT(62) | 844 TEST_INT32_SELECT(62) |
| 836 TEST_INT32_SELECT(63) | 845 TEST_INT32_SELECT(63) |
| 837 | 846 |
| 838 | 847 |
| 839 TEST(Int64Select_registers) { | 848 TEST(Int64Select_registers) { |
| 840 if (RegisterConfiguration::ArchDefault() | 849 if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 841 ->num_allocatable_general_registers() < 2) | 850 ->num_allocatable_general_registers() < 2) |
| 842 return; | 851 return; |
| 843 if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms | 852 if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms |
| 844 | 853 |
| 845 int rarray[] = { | 854 int rarray[] = { |
| 846 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)}; | 855 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 856 ->GetAllocatableGeneralCode(0)}; |
| 847 ArgsBuffer<int64_t>::Sig sig(2); | 857 ArgsBuffer<int64_t>::Sig sig(2); |
| 848 | 858 |
| 849 RegisterPairs pairs; | 859 RegisterPairs pairs; |
| 850 Zone zone; | 860 Zone zone; |
| 851 while (pairs.More()) { | 861 while (pairs.More()) { |
| 852 int parray[2]; | 862 int parray[2]; |
| 853 pairs.Next(&parray[0], &parray[1], false); | 863 pairs.Next(&parray[0], &parray[1], false); |
| 854 Allocator params(parray, 2, nullptr, 0); | 864 Allocator params(parray, 2, nullptr, 0); |
| 855 Allocator rets(rarray, 1, nullptr, 0); | 865 Allocator rets(rarray, 1, nullptr, 0); |
| 856 RegisterConfig config(params, rets); | 866 RegisterConfig config(params, rets); |
| 857 | 867 |
| 858 CallDescriptor* desc = config.Create(&zone, &sig); | 868 CallDescriptor* desc = config.Create(&zone, &sig); |
| 859 RunSelect<int64_t, 0>(desc); | 869 RunSelect<int64_t, 0>(desc); |
| 860 RunSelect<int64_t, 1>(desc); | 870 RunSelect<int64_t, 1>(desc); |
| 861 } | 871 } |
| 862 } | 872 } |
| 863 | 873 |
| 864 | 874 |
| 865 TEST(Float32Select_registers) { | 875 TEST(Float32Select_registers) { |
| 866 if (RegisterConfiguration::ArchDefault()->num_allocatable_double_registers() < | 876 if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 867 2) { | 877 ->num_allocatable_double_registers() < 2) { |
| 868 return; | 878 return; |
| 869 } | 879 } |
| 870 | 880 |
| 871 int rarray[] = { | 881 int rarray[] = { |
| 872 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)}; | 882 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 883 ->GetAllocatableDoubleCode(0)}; |
| 873 ArgsBuffer<float32>::Sig sig(2); | 884 ArgsBuffer<float32>::Sig sig(2); |
| 874 | 885 |
| 875 Float32RegisterPairs pairs; | 886 Float32RegisterPairs pairs; |
| 876 Zone zone; | 887 Zone zone; |
| 877 while (pairs.More()) { | 888 while (pairs.More()) { |
| 878 int parray[2]; | 889 int parray[2]; |
| 879 pairs.Next(&parray[0], &parray[1], false); | 890 pairs.Next(&parray[0], &parray[1], false); |
| 880 Allocator params(nullptr, 0, parray, 2); | 891 Allocator params(nullptr, 0, parray, 2); |
| 881 Allocator rets(nullptr, 0, rarray, 1); | 892 Allocator rets(nullptr, 0, rarray, 1); |
| 882 RegisterConfig config(params, rets); | 893 RegisterConfig config(params, rets); |
| 883 | 894 |
| 884 CallDescriptor* desc = config.Create(&zone, &sig); | 895 CallDescriptor* desc = config.Create(&zone, &sig); |
| 885 RunSelect<float32, 0>(desc); | 896 RunSelect<float32, 0>(desc); |
| 886 RunSelect<float32, 1>(desc); | 897 RunSelect<float32, 1>(desc); |
| 887 } | 898 } |
| 888 } | 899 } |
| 889 | 900 |
| 890 | 901 |
| 891 TEST(Float64Select_registers) { | 902 TEST(Float64Select_registers) { |
| 892 if (RegisterConfiguration::ArchDefault()->num_allocatable_double_registers() < | 903 if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 893 2) | 904 ->num_allocatable_double_registers() < 2) |
| 894 return; | 905 return; |
| 895 if (RegisterConfiguration::ArchDefault() | 906 if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 896 ->num_allocatable_general_registers() < 2) | 907 ->num_allocatable_general_registers() < 2) |
| 897 return; | 908 return; |
| 898 int rarray[] = { | 909 int rarray[] = { |
| 899 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)}; | 910 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 911 ->GetAllocatableDoubleCode(0)}; |
| 900 ArgsBuffer<float64>::Sig sig(2); | 912 ArgsBuffer<float64>::Sig sig(2); |
| 901 | 913 |
| 902 Float64RegisterPairs pairs; | 914 Float64RegisterPairs pairs; |
| 903 Zone zone; | 915 Zone zone; |
| 904 while (pairs.More()) { | 916 while (pairs.More()) { |
| 905 int parray[2]; | 917 int parray[2]; |
| 906 pairs.Next(&parray[0], &parray[1], false); | 918 pairs.Next(&parray[0], &parray[1], false); |
| 907 Allocator params(nullptr, 0, parray, 2); | 919 Allocator params(nullptr, 0, parray, 2); |
| 908 Allocator rets(nullptr, 0, rarray, 1); | 920 Allocator rets(nullptr, 0, rarray, 1); |
| 909 RegisterConfig config(params, rets); | 921 RegisterConfig config(params, rets); |
| 910 | 922 |
| 911 CallDescriptor* desc = config.Create(&zone, &sig); | 923 CallDescriptor* desc = config.Create(&zone, &sig); |
| 912 RunSelect<float64, 0>(desc); | 924 RunSelect<float64, 0>(desc); |
| 913 RunSelect<float64, 1>(desc); | 925 RunSelect<float64, 1>(desc); |
| 914 } | 926 } |
| 915 } | 927 } |
| 916 | 928 |
| 917 | 929 |
| 918 TEST(Float32Select_stack_params_return_reg) { | 930 TEST(Float32Select_stack_params_return_reg) { |
| 919 if (DISABLE_NATIVE_STACK_PARAMS) return; | 931 if (DISABLE_NATIVE_STACK_PARAMS) return; |
| 920 int rarray[] = { | 932 int rarray[] = { |
| 921 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)}; | 933 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 934 ->GetAllocatableDoubleCode(0)}; |
| 922 Allocator params(nullptr, 0, nullptr, 0); | 935 Allocator params(nullptr, 0, nullptr, 0); |
| 923 Allocator rets(nullptr, 0, rarray, 1); | 936 Allocator rets(nullptr, 0, rarray, 1); |
| 924 RegisterConfig config(params, rets); | 937 RegisterConfig config(params, rets); |
| 925 | 938 |
| 926 Zone zone; | 939 Zone zone; |
| 927 for (int count = 1; count < 6; count++) { | 940 for (int count = 1; count < 6; count++) { |
| 928 ArgsBuffer<float32>::Sig sig(count); | 941 ArgsBuffer<float32>::Sig sig(count); |
| 929 CallDescriptor* desc = config.Create(&zone, &sig); | 942 CallDescriptor* desc = config.Create(&zone, &sig); |
| 930 RunSelect<float32, 0>(desc); | 943 RunSelect<float32, 0>(desc); |
| 931 RunSelect<float32, 1>(desc); | 944 RunSelect<float32, 1>(desc); |
| 932 RunSelect<float32, 2>(desc); | 945 RunSelect<float32, 2>(desc); |
| 933 RunSelect<float32, 3>(desc); | 946 RunSelect<float32, 3>(desc); |
| 934 RunSelect<float32, 4>(desc); | 947 RunSelect<float32, 4>(desc); |
| 935 RunSelect<float32, 5>(desc); | 948 RunSelect<float32, 5>(desc); |
| 936 } | 949 } |
| 937 } | 950 } |
| 938 | 951 |
| 939 | 952 |
| 940 TEST(Float64Select_stack_params_return_reg) { | 953 TEST(Float64Select_stack_params_return_reg) { |
| 941 if (DISABLE_NATIVE_STACK_PARAMS) return; | 954 if (DISABLE_NATIVE_STACK_PARAMS) return; |
| 942 int rarray[] = { | 955 int rarray[] = { |
| 943 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)}; | 956 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 957 ->GetAllocatableDoubleCode(0)}; |
| 944 Allocator params(nullptr, 0, nullptr, 0); | 958 Allocator params(nullptr, 0, nullptr, 0); |
| 945 Allocator rets(nullptr, 0, rarray, 1); | 959 Allocator rets(nullptr, 0, rarray, 1); |
| 946 RegisterConfig config(params, rets); | 960 RegisterConfig config(params, rets); |
| 947 | 961 |
| 948 Zone zone; | 962 Zone zone; |
| 949 for (int count = 1; count < 6; count++) { | 963 for (int count = 1; count < 6; count++) { |
| 950 ArgsBuffer<float64>::Sig sig(count); | 964 ArgsBuffer<float64>::Sig sig(count); |
| 951 CallDescriptor* desc = config.Create(&zone, &sig); | 965 CallDescriptor* desc = config.Create(&zone, &sig); |
| 952 RunSelect<float64, 0>(desc); | 966 RunSelect<float64, 0>(desc); |
| 953 RunSelect<float64, 1>(desc); | 967 RunSelect<float64, 1>(desc); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 Node* call = raw.CallN(desc, target, args); | 1002 Node* call = raw.CallN(desc, target, args); |
| 989 raw.Return(call); | 1003 raw.Return(call); |
| 990 } | 1004 } |
| 991 } | 1005 } |
| 992 | 1006 |
| 993 | 1007 |
| 994 TEST(Float64StackParamsToStackParams) { | 1008 TEST(Float64StackParamsToStackParams) { |
| 995 if (DISABLE_NATIVE_STACK_PARAMS) return; | 1009 if (DISABLE_NATIVE_STACK_PARAMS) return; |
| 996 | 1010 |
| 997 int rarray[] = { | 1011 int rarray[] = { |
| 998 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)}; | 1012 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 1013 ->GetAllocatableDoubleCode(0)}; |
| 999 Allocator params(nullptr, 0, nullptr, 0); | 1014 Allocator params(nullptr, 0, nullptr, 0); |
| 1000 Allocator rets(nullptr, 0, rarray, 1); | 1015 Allocator rets(nullptr, 0, rarray, 1); |
| 1001 | 1016 |
| 1002 Zone zone; | 1017 Zone zone; |
| 1003 ArgsBuffer<float64>::Sig sig(2); | 1018 ArgsBuffer<float64>::Sig sig(2); |
| 1004 RegisterConfig config(params, rets); | 1019 RegisterConfig config(params, rets); |
| 1005 CallDescriptor* desc = config.Create(&zone, &sig); | 1020 CallDescriptor* desc = config.Create(&zone, &sig); |
| 1006 | 1021 |
| 1007 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 0>, | 1022 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 0>, |
| 1008 Compute_Select<float64, 0>, 1098); | 1023 Compute_Select<float64, 0>, 1098); |
| 1009 | 1024 |
| 1010 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 1>, | 1025 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 1>, |
| 1011 Compute_Select<float64, 1>, 1099); | 1026 Compute_Select<float64, 1>, 1099); |
| 1012 } | 1027 } |
| 1013 | 1028 |
| 1014 | 1029 |
| 1015 void MixedParamTest(int start) { | 1030 void MixedParamTest(int start) { |
| 1016 if (DISABLE_NATIVE_STACK_PARAMS) return; | 1031 if (DISABLE_NATIVE_STACK_PARAMS) return; |
| 1017 if (RegisterConfiguration::ArchDefault()->num_double_registers() < 2) return; | 1032 if (RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 1033 ->num_double_registers() < 2) |
| 1034 return; |
| 1018 | 1035 |
| 1019 // TODO(titzer): mix in 64-bit types on all platforms when supported. | 1036 // TODO(titzer): mix in 64-bit types on all platforms when supported. |
| 1020 #if V8_TARGET_ARCH_32_BIT | 1037 #if V8_TARGET_ARCH_32_BIT |
| 1021 static MachineType types[] = { | 1038 static MachineType types[] = { |
| 1022 kMachInt32, kMachFloat32, kMachFloat64, kMachInt32, kMachFloat64, | 1039 kMachInt32, kMachFloat32, kMachFloat64, kMachInt32, kMachFloat64, |
| 1023 kMachFloat32, kMachFloat32, kMachFloat64, kMachInt32, kMachFloat32, | 1040 kMachFloat32, kMachFloat32, kMachFloat64, kMachInt32, kMachFloat32, |
| 1024 kMachInt32, kMachFloat64, kMachFloat64, kMachFloat32, kMachInt32, | 1041 kMachInt32, kMachFloat64, kMachFloat64, kMachFloat32, kMachInt32, |
| 1025 kMachFloat64, kMachInt32, kMachFloat32}; | 1042 kMachFloat64, kMachInt32, kMachFloat32}; |
| 1026 #else | 1043 #else |
| 1027 static MachineType types[] = { | 1044 static MachineType types[] = { |
| 1028 kMachInt32, kMachInt64, kMachFloat32, kMachFloat64, kMachInt32, | 1045 kMachInt32, kMachInt64, kMachFloat32, kMachFloat64, kMachInt32, |
| 1029 kMachFloat64, kMachFloat32, kMachInt64, kMachFloat64, kMachInt32, | 1046 kMachFloat64, kMachFloat32, kMachInt64, kMachFloat64, kMachInt32, |
| 1030 kMachFloat32, kMachInt32, kMachFloat64, kMachFloat64, kMachInt64, | 1047 kMachFloat32, kMachInt32, kMachFloat64, kMachFloat64, kMachInt64, |
| 1031 kMachInt32, kMachFloat64, kMachInt32, kMachFloat32}; | 1048 kMachInt32, kMachFloat64, kMachInt32, kMachFloat32}; |
| 1032 #endif | 1049 #endif |
| 1033 | 1050 |
| 1034 Isolate* isolate = CcTest::InitIsolateOnce(); | 1051 Isolate* isolate = CcTest::InitIsolateOnce(); |
| 1035 | 1052 |
| 1036 // Build machine signature | 1053 // Build machine signature |
| 1037 MachineType* params = &types[start]; | 1054 MachineType* params = &types[start]; |
| 1038 const int num_params = static_cast<int>(arraysize(types) - start); | 1055 const int num_params = static_cast<int>(arraysize(types) - start); |
| 1039 | 1056 |
| 1040 // Build call descriptor | 1057 // Build call descriptor |
| 1041 int parray_gp[] = { | 1058 int parray_gp[] = { |
| 1042 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0), | 1059 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 1043 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(1)}; | 1060 ->GetAllocatableGeneralCode(0), |
| 1061 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 1062 ->GetAllocatableGeneralCode(1)}; |
| 1044 int rarray_gp[] = { | 1063 int rarray_gp[] = { |
| 1045 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)}; | 1064 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 1065 ->GetAllocatableGeneralCode(0)}; |
| 1046 int parray_fp[] = { | 1066 int parray_fp[] = { |
| 1047 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0), | 1067 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 1048 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(1)}; | 1068 ->GetAllocatableDoubleCode(0), |
| 1069 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 1070 ->GetAllocatableDoubleCode(1)}; |
| 1049 int rarray_fp[] = { | 1071 int rarray_fp[] = { |
| 1050 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)}; | 1072 RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) |
| 1073 ->GetAllocatableDoubleCode(0)}; |
| 1051 Allocator palloc(parray_gp, 2, parray_fp, 2); | 1074 Allocator palloc(parray_gp, 2, parray_fp, 2); |
| 1052 Allocator ralloc(rarray_gp, 1, rarray_fp, 1); | 1075 Allocator ralloc(rarray_gp, 1, rarray_fp, 1); |
| 1053 RegisterConfig config(palloc, ralloc); | 1076 RegisterConfig config(palloc, ralloc); |
| 1054 | 1077 |
| 1055 for (int which = 0; which < num_params; which++) { | 1078 for (int which = 0; which < num_params; which++) { |
| 1056 Zone zone; | 1079 Zone zone; |
| 1057 HandleScope scope(isolate); | 1080 HandleScope scope(isolate); |
| 1058 MachineSignature::Builder builder(&zone, 1, num_params); | 1081 MachineSignature::Builder builder(&zone, 1, num_params); |
| 1059 builder.AddReturn(params[which]); | 1082 builder.AddReturn(params[which]); |
| 1060 for (int j = 0; j < num_params; j++) builder.AddParam(params[j]); | 1083 for (int j = 0; j < num_params; j++) builder.AddParam(params[j]); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 } | 1156 } |
| 1134 } | 1157 } |
| 1135 } | 1158 } |
| 1136 } | 1159 } |
| 1137 | 1160 |
| 1138 | 1161 |
| 1139 TEST(MixedParams_0) { MixedParamTest(0); } | 1162 TEST(MixedParams_0) { MixedParamTest(0); } |
| 1140 TEST(MixedParams_1) { MixedParamTest(1); } | 1163 TEST(MixedParams_1) { MixedParamTest(1); } |
| 1141 TEST(MixedParams_2) { MixedParamTest(2); } | 1164 TEST(MixedParams_2) { MixedParamTest(2); } |
| 1142 TEST(MixedParams_3) { MixedParamTest(3); } | 1165 TEST(MixedParams_3) { MixedParamTest(3); } |
| OLD | NEW |