Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: test/cctest/compiler/test-run-native-calls.cc

Issue 1365073002: Revert of Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/compiler/test-gap-resolver.cc ('k') | test/cctest/test-code-stubs-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 10
12 #include "test/cctest/cctest.h" 11 #include "test/cctest/cctest.h"
13 #include "test/cctest/compiler/codegen-tester.h" 12 #include "test/cctest/compiler/codegen-tester.h"
14 #include "test/cctest/compiler/graph-builder-tester.h" 13 #include "test/cctest/compiler/graph-builder-tester.h"
15 #include "test/cctest/compiler/value-helper.h" 14 #include "test/cctest/compiler/value-helper.h"
16 15
17 using namespace v8::base; 16 using namespace v8::base;
18 using namespace v8::internal; 17 using namespace v8::internal;
19 using namespace v8::internal::compiler; 18 using namespace v8::internal::compiler;
20 19
21 typedef RawMachineAssembler::Label MLabel; 20 typedef RawMachineAssembler::Label MLabel;
22 21
23 #if V8_TARGET_ARCH_ARM64 22 #if V8_TARGET_ARCH_ARM64
24 // TODO(titzer): fix native stack parameters on arm64 23 // TODO(titzer): fix native stack parameters on arm64
25 #define DISABLE_NATIVE_STACK_PARAMS true 24 #define DISABLE_NATIVE_STACK_PARAMS true
26 #else 25 #else
27 #define DISABLE_NATIVE_STACK_PARAMS false 26 #define DISABLE_NATIVE_STACK_PARAMS false
28 #endif 27 #endif
29 28
30 namespace { 29 namespace {
31 typedef float float32; 30 typedef float float32;
32 typedef double float64; 31 typedef double float64;
33 32
34 // Picks a representative pair of integers from the given range. 33 // Picks a representative pair of integers from the given range.
35 // If there are less than {max_pairs} possible pairs, do them all, otherwise try 34 // If there are less than {max_pairs} possible pairs, do them all, otherwise try
36 // to select a representative set. 35 // to select a representative set.
37 class Pairs { 36 class Pairs {
38 public: 37 public:
39 Pairs(int max_pairs, int range, const int* codes) 38 Pairs(int max_pairs, int range)
40 : range_(range), 39 : range_(range),
41 codes_(codes),
42 max_pairs_(std::min(max_pairs, range_ * range_)), 40 max_pairs_(std::min(max_pairs, range_ * range_)),
43 counter_(0) {} 41 counter_(0) {}
44 42
45 bool More() { return counter_ < max_pairs_; } 43 bool More() { return counter_ < max_pairs_; }
46 44
47 void Next(int* r0, int* r1, bool same_is_ok) { 45 void Next(int* r0, int* r1, bool same_is_ok) {
48 do { 46 do {
49 // Find the next pair. 47 // Find the next pair.
50 if (exhaustive()) { 48 if (exhaustive()) {
51 *r0 = codes_[counter_ % range_]; 49 *r0 = counter_ % range_;
52 *r1 = codes_[counter_ / range_]; 50 *r1 = counter_ / range_;
53 } else { 51 } else {
54 // Try each integer at least once for both r0 and r1. 52 // Try each integer at least once for both r0 and r1.
55 int index = counter_ / 2; 53 int index = counter_ / 2;
56 if (counter_ & 1) { 54 if (counter_ & 1) {
57 *r0 = codes_[index % range_]; 55 *r0 = index % range_;
58 *r1 = codes_[index / range_]; 56 *r1 = index / range_;
59 } else { 57 } else {
60 *r1 = codes_[index % range_]; 58 *r1 = index % range_;
61 *r0 = codes_[index / range_]; 59 *r0 = index / range_;
62 } 60 }
63 } 61 }
64 counter_++; 62 counter_++;
65 if ((same_is_ok) || (*r0 != *r1)) break; 63 if (same_is_ok) break;
66 if (counter_ == max_pairs_) { 64 if (*r0 == *r1) {
67 // For the last hurrah, reg#0 with reg#n-1 65 if (counter_ >= max_pairs_) {
68 *r0 = codes_[0]; 66 // For the last hurrah, reg#0 with reg#n-1
69 *r1 = codes_[range_ - 1]; 67 *r0 = 0;
70 break; 68 *r1 = range_ - 1;
69 break;
70 }
71 } 71 }
72 } while (true); 72 } while (true);
73
74 DCHECK(*r0 >= 0 && *r0 < range_);
75 DCHECK(*r1 >= 0 && *r1 < range_);
73 } 76 }
74 77
75 private: 78 private:
76 int range_; 79 int range_;
77 const int* codes_;
78 int max_pairs_; 80 int max_pairs_;
79 int counter_; 81 int counter_;
80 bool exhaustive() { return max_pairs_ == (range_ * range_); } 82 bool exhaustive() { return max_pairs_ == (range_ * range_); }
81 }; 83 };
82 84
83 85
84 // Pairs of general purpose registers. 86 // Pairs of general purpose registers.
85 class RegisterPairs : public Pairs { 87 class RegisterPairs : public Pairs {
86 public: 88 public:
87 RegisterPairs() 89 RegisterPairs() : Pairs(100, Register::kMaxNumAllocatableRegisters) {}
88 : Pairs(
89 100, RegisterConfiguration::ArchDefault()
90 ->num_allocatable_general_registers(),
91 RegisterConfiguration::ArchDefault()->allocatable_general_codes()) {
92 }
93 }; 90 };
94 91
95 92
96 // Pairs of double registers. 93 // Pairs of double registers.
97 class Float32RegisterPairs : public Pairs { 94 class Float32RegisterPairs : public Pairs {
98 public: 95 public:
99 Float32RegisterPairs() 96 Float32RegisterPairs()
100 : Pairs( 97 : Pairs(100, DoubleRegister::NumAllocatableAliasedRegisters()) {}
101 100, RegisterConfiguration::ArchDefault()
102 ->num_allocatable_aliased_double_registers(),
103 RegisterConfiguration::ArchDefault()->allocatable_double_codes()) {}
104 }; 98 };
105 99
106 100
107 // Pairs of double registers. 101 // Pairs of double registers.
108 class Float64RegisterPairs : public Pairs { 102 class Float64RegisterPairs : public Pairs {
109 public: 103 public:
110 Float64RegisterPairs() 104 Float64RegisterPairs()
111 : Pairs( 105 : Pairs(100, DoubleRegister::NumAllocatableAliasedRegisters()) {}
112 100, RegisterConfiguration::ArchDefault()
113 ->num_allocatable_aliased_double_registers(),
114 RegisterConfiguration::ArchDefault()->allocatable_double_codes()) {}
115 }; 106 };
116 107
117 108
118 // Helper for allocating either an GP or FP reg, or the next stack slot. 109 // Helper for allocating either an GP or FP reg, or the next stack slot.
119 struct Allocator { 110 struct Allocator {
120 Allocator(int* gp, int gpc, int* fp, int fpc) 111 Allocator(int* gp, int gpc, int* fp, int fpc)
121 : gp_count(gpc), 112 : gp_count(gpc),
122 gp_offset(0), 113 gp_offset(0),
123 gp_regs(gp), 114 gp_regs(gp),
124 fp_count(fpc), 115 fp_count(fpc),
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 Allocator params(parray, 2, nullptr, 0); 617 Allocator params(parray, 2, nullptr, 0);
627 Allocator rets(rarray, 1, nullptr, 0); 618 Allocator rets(rarray, 1, nullptr, 0);
628 RegisterConfig config(params, rets); 619 RegisterConfig config(params, rets);
629 CallDescriptor* desc = config.Create(&zone, &sig); 620 CallDescriptor* desc = config.Create(&zone, &sig);
630 TestInt32Sub(desc); 621 TestInt32Sub(desc);
631 } 622 }
632 } 623 }
633 624
634 625
635 // Separate tests for parallelization. 626 // Separate tests for parallelization.
636 #define TEST_INT32_SUB_WITH_RET(x) \ 627 #define TEST_INT32_SUB_WITH_RET(x) \
637 TEST(Run_Int32Sub_all_allocatable_pairs_##x) { \ 628 TEST(Run_Int32Sub_all_allocatable_pairs_##x) { \
638 if (x < Register::kNumRegisters && \ 629 if (Register::kMaxNumAllocatableRegisters > x) Test_RunInt32SubWithRet(x); \
639 Register::from_code(x).IsAllocatable()) { \
640 Test_RunInt32SubWithRet(x); \
641 } \
642 } 630 }
643 631
644 632
645 TEST_INT32_SUB_WITH_RET(0) 633 TEST_INT32_SUB_WITH_RET(0)
646 TEST_INT32_SUB_WITH_RET(1) 634 TEST_INT32_SUB_WITH_RET(1)
647 TEST_INT32_SUB_WITH_RET(2) 635 TEST_INT32_SUB_WITH_RET(2)
648 TEST_INT32_SUB_WITH_RET(3) 636 TEST_INT32_SUB_WITH_RET(3)
649 TEST_INT32_SUB_WITH_RET(4) 637 TEST_INT32_SUB_WITH_RET(4)
650 TEST_INT32_SUB_WITH_RET(5) 638 TEST_INT32_SUB_WITH_RET(5)
651 TEST_INT32_SUB_WITH_RET(6) 639 TEST_INT32_SUB_WITH_RET(6)
(...skipping 30 matching lines...) Expand all
682 } 670 }
683 671
684 672
685 TEST(Run_CopyTwentyInt32_all_allocatable_pairs) { 673 TEST(Run_CopyTwentyInt32_all_allocatable_pairs) {
686 if (DISABLE_NATIVE_STACK_PARAMS) return; 674 if (DISABLE_NATIVE_STACK_PARAMS) return;
687 Int32Signature sig(20); 675 Int32Signature sig(20);
688 RegisterPairs pairs; 676 RegisterPairs pairs;
689 while (pairs.More()) { 677 while (pairs.More()) {
690 Zone zone; 678 Zone zone;
691 int parray[2]; 679 int parray[2];
692 int rarray[] = { 680 int rarray[] = {0};
693 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)};
694 pairs.Next(&parray[0], &parray[1], false); 681 pairs.Next(&parray[0], &parray[1], false);
695 Allocator params(parray, 2, nullptr, 0); 682 Allocator params(parray, 2, nullptr, 0);
696 Allocator rets(rarray, 1, nullptr, 0); 683 Allocator rets(rarray, 1, nullptr, 0);
697 RegisterConfig config(params, rets); 684 RegisterConfig config(params, rets);
698 CallDescriptor* desc = config.Create(&zone, &sig); 685 CallDescriptor* desc = config.Create(&zone, &sig);
699 CopyTwentyInt32(desc); 686 CopyTwentyInt32(desc);
700 } 687 }
701 } 688 }
702 689
703 690
(...skipping 26 matching lines...) Expand all
730 for (int i = 0; i < ParamCount(desc); i++) { 717 for (int i = 0; i < ParamCount(desc); i++) {
731 result += static_cast<uint32_t>(input[i]) * coeff[i]; 718 result += static_cast<uint32_t>(input[i]) * coeff[i];
732 } 719 }
733 return static_cast<int32_t>(result); 720 return static_cast<int32_t>(result);
734 } 721 }
735 722
736 723
737 static void Test_Int32_WeightedSum_of_size(int count) { 724 static void Test_Int32_WeightedSum_of_size(int count) {
738 if (DISABLE_NATIVE_STACK_PARAMS) return; 725 if (DISABLE_NATIVE_STACK_PARAMS) return;
739 Int32Signature sig(count); 726 Int32Signature sig(count);
740 for (int p0 = 0; p0 < Register::kNumRegisters; p0++) { 727 for (int p0 = 0; p0 < Register::kMaxNumAllocatableRegisters; p0++) {
741 if (Register::from_code(p0).IsAllocatable()) { 728 Zone zone;
742 Zone zone;
743 729
744 int parray[] = {p0}; 730 int parray[] = {p0};
745 int rarray[] = { 731 int rarray[] = {0};
746 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)}; 732 Allocator params(parray, 1, nullptr, 0);
747 Allocator params(parray, 1, nullptr, 0); 733 Allocator rets(rarray, 1, nullptr, 0);
748 Allocator rets(rarray, 1, nullptr, 0); 734 RegisterConfig config(params, rets);
749 RegisterConfig config(params, rets); 735 CallDescriptor* desc = config.Create(&zone, &sig);
750 CallDescriptor* desc = config.Create(&zone, &sig); 736 Run_Computation<int32_t>(desc, Build_Int32_WeightedSum,
751 Run_Computation<int32_t>(desc, Build_Int32_WeightedSum, 737 Compute_Int32_WeightedSum, 257 + count);
752 Compute_Int32_WeightedSum, 257 + count);
753 }
754 } 738 }
755 } 739 }
756 740
757 741
758 // Separate tests for parallelization. 742 // Separate tests for parallelization.
759 #define TEST_INT32_WEIGHTEDSUM(x) \ 743 #define TEST_INT32_WEIGHTEDSUM(x) \
760 TEST(Run_Int32_WeightedSum_##x) { Test_Int32_WeightedSum_of_size(x); } 744 TEST(Run_Int32_WeightedSum_##x) { Test_Int32_WeightedSum_of_size(x); }
761 745
762 746
763 TEST_INT32_WEIGHTEDSUM(1) 747 TEST_INT32_WEIGHTEDSUM(1)
(...skipping 27 matching lines...) Expand all
791 Run_Computation<CType>(desc, Build_Select<which>, 775 Run_Computation<CType>(desc, Build_Select<which>,
792 Compute_Select<CType, which>, 776 Compute_Select<CType, which>,
793 1044 + which + 3 * sizeof(CType)); 777 1044 + which + 3 * sizeof(CType));
794 } 778 }
795 779
796 780
797 template <int which> 781 template <int which>
798 void Test_Int32_Select() { 782 void Test_Int32_Select() {
799 if (DISABLE_NATIVE_STACK_PARAMS) return; 783 if (DISABLE_NATIVE_STACK_PARAMS) return;
800 784
801 int parray[] = { 785 int parray[] = {0};
802 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)}; 786 int rarray[] = {0};
803 int rarray[] = {
804 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)};
805 Allocator params(parray, 1, nullptr, 0); 787 Allocator params(parray, 1, nullptr, 0);
806 Allocator rets(rarray, 1, nullptr, 0); 788 Allocator rets(rarray, 1, nullptr, 0);
807 RegisterConfig config(params, rets); 789 RegisterConfig config(params, rets);
808 790
809 Zone zone; 791 Zone zone;
810 792
811 for (int i = which + 1; i <= 64; i++) { 793 for (int i = which + 1; i <= 64; i++) {
812 Int32Signature sig(i); 794 Int32Signature sig(i);
813 CallDescriptor* desc = config.Create(&zone, &sig); 795 CallDescriptor* desc = config.Create(&zone, &sig);
814 RunSelect<int32_t, which>(desc); 796 RunSelect<int32_t, which>(desc);
(...skipping 15 matching lines...) Expand all
830 TEST_INT32_SELECT(6) 812 TEST_INT32_SELECT(6)
831 TEST_INT32_SELECT(11) 813 TEST_INT32_SELECT(11)
832 TEST_INT32_SELECT(15) 814 TEST_INT32_SELECT(15)
833 TEST_INT32_SELECT(19) 815 TEST_INT32_SELECT(19)
834 TEST_INT32_SELECT(45) 816 TEST_INT32_SELECT(45)
835 TEST_INT32_SELECT(62) 817 TEST_INT32_SELECT(62)
836 TEST_INT32_SELECT(63) 818 TEST_INT32_SELECT(63)
837 819
838 820
839 TEST(Int64Select_registers) { 821 TEST(Int64Select_registers) {
840 if (RegisterConfiguration::ArchDefault() 822 if (Register::kMaxNumAllocatableRegisters < 2) return;
841 ->num_allocatable_general_registers() < 2)
842 return;
843 if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms 823 if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms
844 824
845 int rarray[] = { 825 int rarray[] = {0};
846 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)};
847 ArgsBuffer<int64_t>::Sig sig(2); 826 ArgsBuffer<int64_t>::Sig sig(2);
848 827
849 RegisterPairs pairs; 828 RegisterPairs pairs;
850 Zone zone; 829 Zone zone;
851 while (pairs.More()) { 830 while (pairs.More()) {
852 int parray[2]; 831 int parray[2];
853 pairs.Next(&parray[0], &parray[1], false); 832 pairs.Next(&parray[0], &parray[1], false);
854 Allocator params(parray, 2, nullptr, 0); 833 Allocator params(parray, 2, nullptr, 0);
855 Allocator rets(rarray, 1, nullptr, 0); 834 Allocator rets(rarray, 1, nullptr, 0);
856 RegisterConfig config(params, rets); 835 RegisterConfig config(params, rets);
857 836
858 CallDescriptor* desc = config.Create(&zone, &sig); 837 CallDescriptor* desc = config.Create(&zone, &sig);
859 RunSelect<int64_t, 0>(desc); 838 RunSelect<int64_t, 0>(desc);
860 RunSelect<int64_t, 1>(desc); 839 RunSelect<int64_t, 1>(desc);
861 } 840 }
862 } 841 }
863 842
864 843
865 TEST(Float32Select_registers) { 844 TEST(Float32Select_registers) {
866 if (RegisterConfiguration::ArchDefault()->num_allocatable_double_registers() < 845 if (RegisterConfiguration::ArchDefault()->num_double_registers() < 2) return;
867 2) {
868 return;
869 }
870 846
871 int rarray[] = { 847 int rarray[] = {0};
872 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
873 ArgsBuffer<float32>::Sig sig(2); 848 ArgsBuffer<float32>::Sig sig(2);
874 849
875 Float32RegisterPairs pairs; 850 Float32RegisterPairs pairs;
876 Zone zone; 851 Zone zone;
877 while (pairs.More()) { 852 while (pairs.More()) {
878 int parray[2]; 853 int parray[2];
879 pairs.Next(&parray[0], &parray[1], false); 854 pairs.Next(&parray[0], &parray[1], false);
880 Allocator params(nullptr, 0, parray, 2); 855 Allocator params(nullptr, 0, parray, 2);
881 Allocator rets(nullptr, 0, rarray, 1); 856 Allocator rets(nullptr, 0, rarray, 1);
882 RegisterConfig config(params, rets); 857 RegisterConfig config(params, rets);
883 858
884 CallDescriptor* desc = config.Create(&zone, &sig); 859 CallDescriptor* desc = config.Create(&zone, &sig);
885 RunSelect<float32, 0>(desc); 860 RunSelect<float32, 0>(desc);
886 RunSelect<float32, 1>(desc); 861 RunSelect<float32, 1>(desc);
887 } 862 }
888 } 863 }
889 864
890 865
891 TEST(Float64Select_registers) { 866 TEST(Float64Select_registers) {
892 if (RegisterConfiguration::ArchDefault()->num_allocatable_double_registers() < 867 if (RegisterConfiguration::ArchDefault()->num_double_registers() < 2) return;
893 2) 868
894 return; 869 int rarray[] = {0};
895 if (RegisterConfiguration::ArchDefault()
896 ->num_allocatable_general_registers() < 2)
897 return;
898 int rarray[] = {
899 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
900 ArgsBuffer<float64>::Sig sig(2); 870 ArgsBuffer<float64>::Sig sig(2);
901 871
902 Float64RegisterPairs pairs; 872 Float64RegisterPairs pairs;
903 Zone zone; 873 Zone zone;
904 while (pairs.More()) { 874 while (pairs.More()) {
905 int parray[2]; 875 int parray[2];
906 pairs.Next(&parray[0], &parray[1], false); 876 pairs.Next(&parray[0], &parray[1], false);
907 Allocator params(nullptr, 0, parray, 2); 877 Allocator params(nullptr, 0, parray, 2);
908 Allocator rets(nullptr, 0, rarray, 1); 878 Allocator rets(nullptr, 0, rarray, 1);
909 RegisterConfig config(params, rets); 879 RegisterConfig config(params, rets);
910 880
911 CallDescriptor* desc = config.Create(&zone, &sig); 881 CallDescriptor* desc = config.Create(&zone, &sig);
912 RunSelect<float64, 0>(desc); 882 RunSelect<float64, 0>(desc);
913 RunSelect<float64, 1>(desc); 883 RunSelect<float64, 1>(desc);
914 } 884 }
915 } 885 }
916 886
917 887
918 TEST(Float32Select_stack_params_return_reg) { 888 TEST(Float32Select_stack_params_return_reg) {
919 if (DISABLE_NATIVE_STACK_PARAMS) return; 889 if (DISABLE_NATIVE_STACK_PARAMS) return;
920 int rarray[] = { 890 int rarray[] = {0};
921 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
922 Allocator params(nullptr, 0, nullptr, 0); 891 Allocator params(nullptr, 0, nullptr, 0);
923 Allocator rets(nullptr, 0, rarray, 1); 892 Allocator rets(nullptr, 0, rarray, 1);
924 RegisterConfig config(params, rets); 893 RegisterConfig config(params, rets);
925 894
926 Zone zone; 895 Zone zone;
927 for (int count = 1; count < 6; count++) { 896 for (int count = 1; count < 6; count++) {
928 ArgsBuffer<float32>::Sig sig(count); 897 ArgsBuffer<float32>::Sig sig(count);
929 CallDescriptor* desc = config.Create(&zone, &sig); 898 CallDescriptor* desc = config.Create(&zone, &sig);
930 RunSelect<float32, 0>(desc); 899 RunSelect<float32, 0>(desc);
931 RunSelect<float32, 1>(desc); 900 RunSelect<float32, 1>(desc);
932 RunSelect<float32, 2>(desc); 901 RunSelect<float32, 2>(desc);
933 RunSelect<float32, 3>(desc); 902 RunSelect<float32, 3>(desc);
934 RunSelect<float32, 4>(desc); 903 RunSelect<float32, 4>(desc);
935 RunSelect<float32, 5>(desc); 904 RunSelect<float32, 5>(desc);
936 } 905 }
937 } 906 }
938 907
939 908
940 TEST(Float64Select_stack_params_return_reg) { 909 TEST(Float64Select_stack_params_return_reg) {
941 if (DISABLE_NATIVE_STACK_PARAMS) return; 910 if (DISABLE_NATIVE_STACK_PARAMS) return;
942 int rarray[] = { 911 int rarray[] = {0};
943 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
944 Allocator params(nullptr, 0, nullptr, 0); 912 Allocator params(nullptr, 0, nullptr, 0);
945 Allocator rets(nullptr, 0, rarray, 1); 913 Allocator rets(nullptr, 0, rarray, 1);
946 RegisterConfig config(params, rets); 914 RegisterConfig config(params, rets);
947 915
948 Zone zone; 916 Zone zone;
949 for (int count = 1; count < 6; count++) { 917 for (int count = 1; count < 6; count++) {
950 ArgsBuffer<float64>::Sig sig(count); 918 ArgsBuffer<float64>::Sig sig(count);
951 CallDescriptor* desc = config.Create(&zone, &sig); 919 CallDescriptor* desc = config.Create(&zone, &sig);
952 RunSelect<float64, 0>(desc); 920 RunSelect<float64, 0>(desc);
953 RunSelect<float64, 1>(desc); 921 RunSelect<float64, 1>(desc);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 955
988 Node* call = raw.CallN(desc, target, args); 956 Node* call = raw.CallN(desc, target, args);
989 raw.Return(call); 957 raw.Return(call);
990 } 958 }
991 } 959 }
992 960
993 961
994 TEST(Float64StackParamsToStackParams) { 962 TEST(Float64StackParamsToStackParams) {
995 if (DISABLE_NATIVE_STACK_PARAMS) return; 963 if (DISABLE_NATIVE_STACK_PARAMS) return;
996 964
997 int rarray[] = { 965 int rarray[] = {0};
998 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
999 Allocator params(nullptr, 0, nullptr, 0); 966 Allocator params(nullptr, 0, nullptr, 0);
1000 Allocator rets(nullptr, 0, rarray, 1); 967 Allocator rets(nullptr, 0, rarray, 1);
1001 968
1002 Zone zone; 969 Zone zone;
1003 ArgsBuffer<float64>::Sig sig(2); 970 ArgsBuffer<float64>::Sig sig(2);
1004 RegisterConfig config(params, rets); 971 RegisterConfig config(params, rets);
1005 CallDescriptor* desc = config.Create(&zone, &sig); 972 CallDescriptor* desc = config.Create(&zone, &sig);
1006 973
1007 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 0>, 974 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 0>,
1008 Compute_Select<float64, 0>, 1098); 975 Compute_Select<float64, 0>, 1098);
(...skipping 22 matching lines...) Expand all
1031 kMachInt32, kMachFloat64, kMachInt32, kMachFloat32}; 998 kMachInt32, kMachFloat64, kMachInt32, kMachFloat32};
1032 #endif 999 #endif
1033 1000
1034 Isolate* isolate = CcTest::InitIsolateOnce(); 1001 Isolate* isolate = CcTest::InitIsolateOnce();
1035 1002
1036 // Build machine signature 1003 // Build machine signature
1037 MachineType* params = &types[start]; 1004 MachineType* params = &types[start];
1038 const int num_params = static_cast<int>(arraysize(types) - start); 1005 const int num_params = static_cast<int>(arraysize(types) - start);
1039 1006
1040 // Build call descriptor 1007 // Build call descriptor
1041 int parray_gp[] = { 1008 int parray[] = {0, 1};
1042 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0), 1009 int rarray[] = {0};
1043 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(1)}; 1010 Allocator palloc(parray, 2, parray, 2);
1044 int rarray_gp[] = { 1011 Allocator ralloc(rarray, 1, rarray, 1);
1045 RegisterConfiguration::ArchDefault()->GetAllocatableGeneralCode(0)};
1046 int parray_fp[] = {
1047 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0),
1048 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(1)};
1049 int rarray_fp[] = {
1050 RegisterConfiguration::ArchDefault()->GetAllocatableDoubleCode(0)};
1051 Allocator palloc(parray_gp, 2, parray_fp, 2);
1052 Allocator ralloc(rarray_gp, 1, rarray_fp, 1);
1053 RegisterConfig config(palloc, ralloc); 1012 RegisterConfig config(palloc, ralloc);
1054 1013
1055 for (int which = 0; which < num_params; which++) { 1014 for (int which = 0; which < num_params; which++) {
1056 Zone zone; 1015 Zone zone;
1057 HandleScope scope(isolate); 1016 HandleScope scope(isolate);
1058 MachineSignature::Builder builder(&zone, 1, num_params); 1017 MachineSignature::Builder builder(&zone, 1, num_params);
1059 builder.AddReturn(params[which]); 1018 builder.AddReturn(params[which]);
1060 for (int j = 0; j < num_params; j++) builder.AddParam(params[j]); 1019 for (int j = 0; j < num_params; j++) builder.AddParam(params[j]);
1061 MachineSignature* sig = builder.Build(); 1020 MachineSignature* sig = builder.Build();
1062 CallDescriptor* desc = config.Create(&zone, sig); 1021 CallDescriptor* desc = config.Create(&zone, sig);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 } 1092 }
1134 } 1093 }
1135 } 1094 }
1136 } 1095 }
1137 1096
1138 1097
1139 TEST(MixedParams_0) { MixedParamTest(0); } 1098 TEST(MixedParams_0) { MixedParamTest(0); }
1140 TEST(MixedParams_1) { MixedParamTest(1); } 1099 TEST(MixedParams_1) { MixedParamTest(1); }
1141 TEST(MixedParams_2) { MixedParamTest(2); } 1100 TEST(MixedParams_2) { MixedParamTest(2); }
1142 TEST(MixedParams_3) { MixedParamTest(3); } 1101 TEST(MixedParams_3) { MixedParamTest(3); }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-gap-resolver.cc ('k') | test/cctest/test-code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698