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

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

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