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

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

Issue 2344143003: Moved zones and zone related stuff in its own directory. (Closed)
Patch Set: Merge branch 'master' into zonefolder Created 4 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-node.cc ('k') | test/cctest/test-ast.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/raw-machine-assembler.h" 8 #include "src/compiler/raw-machine-assembler.h"
9 #include "src/machine-type.h" 9 #include "src/machine-type.h"
10 #include "src/register-configuration.h" 10 #include "src/register-configuration.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 598
599 for (int j = 0; j < kNumParams; j++) { 599 for (int j = 0; j < kNumParams; j++) {
600 CHECK_EQ(input[j], output[j]); 600 CHECK_EQ(input[j], output[j]);
601 } 601 }
602 } 602 }
603 } 603 }
604 604
605 605
606 static void Test_RunInt32SubWithRet(int retreg) { 606 static void Test_RunInt32SubWithRet(int retreg) {
607 Int32Signature sig(2); 607 Int32Signature sig(2);
608 base::AccountingAllocator allocator; 608 v8::internal::AccountingAllocator allocator;
609 Zone zone(&allocator); 609 Zone zone(&allocator);
610 RegisterPairs pairs; 610 RegisterPairs pairs;
611 while (pairs.More()) { 611 while (pairs.More()) {
612 int parray[2]; 612 int parray[2];
613 int rarray[] = {retreg}; 613 int rarray[] = {retreg};
614 pairs.Next(&parray[0], &parray[1], false); 614 pairs.Next(&parray[0], &parray[1], false);
615 Allocator params(parray, 2, nullptr, 0); 615 Allocator params(parray, 2, nullptr, 0);
616 Allocator rets(rarray, 1, nullptr, 0); 616 Allocator rets(rarray, 1, nullptr, 0);
617 RegisterConfig config(params, rets); 617 RegisterConfig config(params, rets);
618 CallDescriptor* desc = config.Create(&zone, &sig); 618 CallDescriptor* desc = config.Create(&zone, &sig);
(...skipping 30 matching lines...) Expand all
649 TEST_INT32_SUB_WITH_RET(16) 649 TEST_INT32_SUB_WITH_RET(16)
650 TEST_INT32_SUB_WITH_RET(17) 650 TEST_INT32_SUB_WITH_RET(17)
651 TEST_INT32_SUB_WITH_RET(18) 651 TEST_INT32_SUB_WITH_RET(18)
652 TEST_INT32_SUB_WITH_RET(19) 652 TEST_INT32_SUB_WITH_RET(19)
653 653
654 654
655 TEST(Run_Int32Sub_all_allocatable_single) { 655 TEST(Run_Int32Sub_all_allocatable_single) {
656 Int32Signature sig(2); 656 Int32Signature sig(2);
657 RegisterPairs pairs; 657 RegisterPairs pairs;
658 while (pairs.More()) { 658 while (pairs.More()) {
659 base::AccountingAllocator allocator; 659 v8::internal::AccountingAllocator allocator;
660 Zone zone(&allocator); 660 Zone zone(&allocator);
661 int parray[1]; 661 int parray[1];
662 int rarray[1]; 662 int rarray[1];
663 pairs.Next(&rarray[0], &parray[0], true); 663 pairs.Next(&rarray[0], &parray[0], true);
664 Allocator params(parray, 1, nullptr, 0); 664 Allocator params(parray, 1, nullptr, 0);
665 Allocator rets(rarray, 1, nullptr, 0); 665 Allocator rets(rarray, 1, nullptr, 0);
666 RegisterConfig config(params, rets); 666 RegisterConfig config(params, rets);
667 CallDescriptor* desc = config.Create(&zone, &sig); 667 CallDescriptor* desc = config.Create(&zone, &sig);
668 TestInt32Sub(desc); 668 TestInt32Sub(desc);
669 } 669 }
670 } 670 }
671 671
672 672
673 TEST(Run_CopyTwentyInt32_all_allocatable_pairs) { 673 TEST(Run_CopyTwentyInt32_all_allocatable_pairs) {
674 Int32Signature sig(20); 674 Int32Signature sig(20);
675 RegisterPairs pairs; 675 RegisterPairs pairs;
676 while (pairs.More()) { 676 while (pairs.More()) {
677 base::AccountingAllocator allocator; 677 v8::internal::AccountingAllocator allocator;
678 Zone zone(&allocator); 678 Zone zone(&allocator);
679 int parray[2]; 679 int parray[2];
680 int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; 680 int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
681 pairs.Next(&parray[0], &parray[1], false); 681 pairs.Next(&parray[0], &parray[1], false);
682 Allocator params(parray, 2, nullptr, 0); 682 Allocator params(parray, 2, nullptr, 0);
683 Allocator rets(rarray, 1, nullptr, 0); 683 Allocator rets(rarray, 1, nullptr, 0);
684 RegisterConfig config(params, rets); 684 RegisterConfig config(params, rets);
685 CallDescriptor* desc = config.Create(&zone, &sig); 685 CallDescriptor* desc = config.Create(&zone, &sig);
686 CopyTwentyInt32(desc); 686 CopyTwentyInt32(desc);
687 } 687 }
(...skipping 30 matching lines...) Expand all
718 result += static_cast<uint32_t>(input[i]) * coeff[i]; 718 result += static_cast<uint32_t>(input[i]) * coeff[i];
719 } 719 }
720 return static_cast<int32_t>(result); 720 return static_cast<int32_t>(result);
721 } 721 }
722 722
723 723
724 static void Test_Int32_WeightedSum_of_size(int count) { 724 static void Test_Int32_WeightedSum_of_size(int count) {
725 Int32Signature sig(count); 725 Int32Signature sig(count);
726 for (int p0 = 0; p0 < Register::kNumRegisters; p0++) { 726 for (int p0 = 0; p0 < Register::kNumRegisters; p0++) {
727 if (GetRegConfig()->IsAllocatableGeneralCode(p0)) { 727 if (GetRegConfig()->IsAllocatableGeneralCode(p0)) {
728 base::AccountingAllocator allocator; 728 v8::internal::AccountingAllocator allocator;
729 Zone zone(&allocator); 729 Zone zone(&allocator);
730 730
731 int parray[] = {p0}; 731 int parray[] = {p0};
732 int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; 732 int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
733 Allocator params(parray, 1, nullptr, 0); 733 Allocator params(parray, 1, nullptr, 0);
734 Allocator rets(rarray, 1, nullptr, 0); 734 Allocator rets(rarray, 1, nullptr, 0);
735 RegisterConfig config(params, rets); 735 RegisterConfig config(params, rets);
736 CallDescriptor* desc = config.Create(&zone, &sig); 736 CallDescriptor* desc = config.Create(&zone, &sig);
737 Run_Computation<int32_t>(desc, Build_Int32_WeightedSum, 737 Run_Computation<int32_t>(desc, Build_Int32_WeightedSum,
738 Compute_Int32_WeightedSum, 257 + count); 738 Compute_Int32_WeightedSum, 257 + count);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 781
782 782
783 template <int which> 783 template <int which>
784 void Test_Int32_Select() { 784 void Test_Int32_Select() {
785 int parray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; 785 int parray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
786 int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; 786 int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
787 Allocator params(parray, 1, nullptr, 0); 787 Allocator params(parray, 1, nullptr, 0);
788 Allocator rets(rarray, 1, nullptr, 0); 788 Allocator rets(rarray, 1, nullptr, 0);
789 RegisterConfig config(params, rets); 789 RegisterConfig config(params, rets);
790 790
791 base::AccountingAllocator allocator; 791 v8::internal::AccountingAllocator allocator;
792 Zone zone(&allocator); 792 Zone zone(&allocator);
793 793
794 for (int i = which + 1; i <= 64; i++) { 794 for (int i = which + 1; i <= 64; i++) {
795 Int32Signature sig(i); 795 Int32Signature sig(i);
796 CallDescriptor* desc = config.Create(&zone, &sig); 796 CallDescriptor* desc = config.Create(&zone, &sig);
797 RunSelect<int32_t, which>(desc); 797 RunSelect<int32_t, which>(desc);
798 } 798 }
799 } 799 }
800 800
801 801
(...skipping 18 matching lines...) Expand all
820 820
821 821
822 TEST(Int64Select_registers) { 822 TEST(Int64Select_registers) {
823 if (GetRegConfig()->num_allocatable_general_registers() < 2) return; 823 if (GetRegConfig()->num_allocatable_general_registers() < 2) return;
824 if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms 824 if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms
825 825
826 int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; 826 int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
827 ArgsBuffer<int64_t>::Sig sig(2); 827 ArgsBuffer<int64_t>::Sig sig(2);
828 828
829 RegisterPairs pairs; 829 RegisterPairs pairs;
830 base::AccountingAllocator allocator; 830 v8::internal::AccountingAllocator allocator;
831 Zone zone(&allocator); 831 Zone zone(&allocator);
832 while (pairs.More()) { 832 while (pairs.More()) {
833 int parray[2]; 833 int parray[2];
834 pairs.Next(&parray[0], &parray[1], false); 834 pairs.Next(&parray[0], &parray[1], false);
835 Allocator params(parray, 2, nullptr, 0); 835 Allocator params(parray, 2, nullptr, 0);
836 Allocator rets(rarray, 1, nullptr, 0); 836 Allocator rets(rarray, 1, nullptr, 0);
837 RegisterConfig config(params, rets); 837 RegisterConfig config(params, rets);
838 838
839 CallDescriptor* desc = config.Create(&zone, &sig); 839 CallDescriptor* desc = config.Create(&zone, &sig);
840 RunSelect<int64_t, 0>(desc); 840 RunSelect<int64_t, 0>(desc);
841 RunSelect<int64_t, 1>(desc); 841 RunSelect<int64_t, 1>(desc);
842 } 842 }
843 } 843 }
844 844
845 845
846 TEST(Float32Select_registers) { 846 TEST(Float32Select_registers) {
847 if (GetRegConfig()->num_allocatable_double_registers() < 2) { 847 if (GetRegConfig()->num_allocatable_double_registers() < 2) {
848 return; 848 return;
849 } 849 }
850 850
851 int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; 851 int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
852 ArgsBuffer<float32>::Sig sig(2); 852 ArgsBuffer<float32>::Sig sig(2);
853 853
854 Float32RegisterPairs pairs; 854 Float32RegisterPairs pairs;
855 base::AccountingAllocator allocator; 855 v8::internal::AccountingAllocator allocator;
856 Zone zone(&allocator); 856 Zone zone(&allocator);
857 while (pairs.More()) { 857 while (pairs.More()) {
858 int parray[2]; 858 int parray[2];
859 pairs.Next(&parray[0], &parray[1], false); 859 pairs.Next(&parray[0], &parray[1], false);
860 Allocator params(nullptr, 0, parray, 2); 860 Allocator params(nullptr, 0, parray, 2);
861 Allocator rets(nullptr, 0, rarray, 1); 861 Allocator rets(nullptr, 0, rarray, 1);
862 RegisterConfig config(params, rets); 862 RegisterConfig config(params, rets);
863 863
864 CallDescriptor* desc = config.Create(&zone, &sig); 864 CallDescriptor* desc = config.Create(&zone, &sig);
865 RunSelect<float32, 0>(desc); 865 RunSelect<float32, 0>(desc);
866 RunSelect<float32, 1>(desc); 866 RunSelect<float32, 1>(desc);
867 } 867 }
868 } 868 }
869 869
870 870
871 TEST(Float64Select_registers) { 871 TEST(Float64Select_registers) {
872 if (GetRegConfig()->num_allocatable_double_registers() < 2) return; 872 if (GetRegConfig()->num_allocatable_double_registers() < 2) return;
873 if (GetRegConfig()->num_allocatable_general_registers() < 2) return; 873 if (GetRegConfig()->num_allocatable_general_registers() < 2) return;
874 int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; 874 int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
875 ArgsBuffer<float64>::Sig sig(2); 875 ArgsBuffer<float64>::Sig sig(2);
876 876
877 Float64RegisterPairs pairs; 877 Float64RegisterPairs pairs;
878 base::AccountingAllocator allocator; 878 v8::internal::AccountingAllocator allocator;
879 Zone zone(&allocator); 879 Zone zone(&allocator);
880 while (pairs.More()) { 880 while (pairs.More()) {
881 int parray[2]; 881 int parray[2];
882 pairs.Next(&parray[0], &parray[1], false); 882 pairs.Next(&parray[0], &parray[1], false);
883 Allocator params(nullptr, 0, parray, 2); 883 Allocator params(nullptr, 0, parray, 2);
884 Allocator rets(nullptr, 0, rarray, 1); 884 Allocator rets(nullptr, 0, rarray, 1);
885 RegisterConfig config(params, rets); 885 RegisterConfig config(params, rets);
886 886
887 CallDescriptor* desc = config.Create(&zone, &sig); 887 CallDescriptor* desc = config.Create(&zone, &sig);
888 RunSelect<float64, 0>(desc); 888 RunSelect<float64, 0>(desc);
889 RunSelect<float64, 1>(desc); 889 RunSelect<float64, 1>(desc);
890 } 890 }
891 } 891 }
892 892
893 893
894 TEST(Float32Select_stack_params_return_reg) { 894 TEST(Float32Select_stack_params_return_reg) {
895 int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; 895 int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
896 Allocator params(nullptr, 0, nullptr, 0); 896 Allocator params(nullptr, 0, nullptr, 0);
897 Allocator rets(nullptr, 0, rarray, 1); 897 Allocator rets(nullptr, 0, rarray, 1);
898 RegisterConfig config(params, rets); 898 RegisterConfig config(params, rets);
899 899
900 base::AccountingAllocator allocator; 900 v8::internal::AccountingAllocator allocator;
901 Zone zone(&allocator); 901 Zone zone(&allocator);
902 for (int count = 1; count < 6; count++) { 902 for (int count = 1; count < 6; count++) {
903 ArgsBuffer<float32>::Sig sig(count); 903 ArgsBuffer<float32>::Sig sig(count);
904 CallDescriptor* desc = config.Create(&zone, &sig); 904 CallDescriptor* desc = config.Create(&zone, &sig);
905 RunSelect<float32, 0>(desc); 905 RunSelect<float32, 0>(desc);
906 RunSelect<float32, 1>(desc); 906 RunSelect<float32, 1>(desc);
907 RunSelect<float32, 2>(desc); 907 RunSelect<float32, 2>(desc);
908 RunSelect<float32, 3>(desc); 908 RunSelect<float32, 3>(desc);
909 RunSelect<float32, 4>(desc); 909 RunSelect<float32, 4>(desc);
910 RunSelect<float32, 5>(desc); 910 RunSelect<float32, 5>(desc);
911 } 911 }
912 } 912 }
913 913
914 914
915 TEST(Float64Select_stack_params_return_reg) { 915 TEST(Float64Select_stack_params_return_reg) {
916 int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; 916 int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
917 Allocator params(nullptr, 0, nullptr, 0); 917 Allocator params(nullptr, 0, nullptr, 0);
918 Allocator rets(nullptr, 0, rarray, 1); 918 Allocator rets(nullptr, 0, rarray, 1);
919 RegisterConfig config(params, rets); 919 RegisterConfig config(params, rets);
920 920
921 base::AccountingAllocator allocator; 921 v8::internal::AccountingAllocator allocator;
922 Zone zone(&allocator); 922 Zone zone(&allocator);
923 for (int count = 1; count < 6; count++) { 923 for (int count = 1; count < 6; count++) {
924 ArgsBuffer<float64>::Sig sig(count); 924 ArgsBuffer<float64>::Sig sig(count);
925 CallDescriptor* desc = config.Create(&zone, &sig); 925 CallDescriptor* desc = config.Create(&zone, &sig);
926 RunSelect<float64, 0>(desc); 926 RunSelect<float64, 0>(desc);
927 RunSelect<float64, 1>(desc); 927 RunSelect<float64, 1>(desc);
928 RunSelect<float64, 2>(desc); 928 RunSelect<float64, 2>(desc);
929 RunSelect<float64, 3>(desc); 929 RunSelect<float64, 3>(desc);
930 RunSelect<float64, 4>(desc); 930 RunSelect<float64, 4>(desc);
931 RunSelect<float64, 5>(desc); 931 RunSelect<float64, 5>(desc);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 raw.Return(call); 963 raw.Return(call);
964 } 964 }
965 } 965 }
966 966
967 967
968 TEST(Float64StackParamsToStackParams) { 968 TEST(Float64StackParamsToStackParams) {
969 int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; 969 int rarray[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
970 Allocator params(nullptr, 0, nullptr, 0); 970 Allocator params(nullptr, 0, nullptr, 0);
971 Allocator rets(nullptr, 0, rarray, 1); 971 Allocator rets(nullptr, 0, rarray, 1);
972 972
973 base::AccountingAllocator allocator; 973 v8::internal::AccountingAllocator allocator;
974 Zone zone(&allocator); 974 Zone zone(&allocator);
975 ArgsBuffer<float64>::Sig sig(2); 975 ArgsBuffer<float64>::Sig sig(2);
976 RegisterConfig config(params, rets); 976 RegisterConfig config(params, rets);
977 CallDescriptor* desc = config.Create(&zone, &sig); 977 CallDescriptor* desc = config.Create(&zone, &sig);
978 978
979 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 0>, 979 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 0>,
980 Compute_Select<float64, 0>, 1098); 980 Compute_Select<float64, 0>, 1098);
981 981
982 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 1>, 982 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 1>,
983 Compute_Select<float64, 1>, 1099); 983 Compute_Select<float64, 1>, 1099);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 GetRegConfig()->GetAllocatableGeneralCode(1)}; 1018 GetRegConfig()->GetAllocatableGeneralCode(1)};
1019 int rarray_gp[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; 1019 int rarray_gp[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
1020 int parray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0), 1020 int parray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0),
1021 GetRegConfig()->GetAllocatableDoubleCode(1)}; 1021 GetRegConfig()->GetAllocatableDoubleCode(1)};
1022 int rarray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0)}; 1022 int rarray_fp[] = {GetRegConfig()->GetAllocatableDoubleCode(0)};
1023 Allocator palloc(parray_gp, 2, parray_fp, 2); 1023 Allocator palloc(parray_gp, 2, parray_fp, 2);
1024 Allocator ralloc(rarray_gp, 1, rarray_fp, 1); 1024 Allocator ralloc(rarray_gp, 1, rarray_fp, 1);
1025 RegisterConfig config(palloc, ralloc); 1025 RegisterConfig config(palloc, ralloc);
1026 1026
1027 for (int which = 0; which < num_params; which++) { 1027 for (int which = 0; which < num_params; which++) {
1028 base::AccountingAllocator allocator; 1028 v8::internal::AccountingAllocator allocator;
1029 Zone zone(&allocator); 1029 Zone zone(&allocator);
1030 HandleScope scope(isolate); 1030 HandleScope scope(isolate);
1031 MachineSignature::Builder builder(&zone, 1, num_params); 1031 MachineSignature::Builder builder(&zone, 1, num_params);
1032 builder.AddReturn(params[which]); 1032 builder.AddReturn(params[which]);
1033 for (int j = 0; j < num_params; j++) builder.AddParam(params[j]); 1033 for (int j = 0; j < num_params; j++) builder.AddParam(params[j]);
1034 MachineSignature* sig = builder.Build(); 1034 MachineSignature* sig = builder.Build();
1035 CallDescriptor* desc = config.Create(&zone, sig); 1035 CallDescriptor* desc = config.Create(&zone, sig);
1036 1036
1037 Handle<Code> select; 1037 Handle<Code> select;
1038 { 1038 {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 TestStackSlot(MachineType::Float32(), magic); 1192 TestStackSlot(MachineType::Float32(), magic);
1193 } 1193 }
1194 1194
1195 TEST(RunStackSlotFloat64) { 1195 TEST(RunStackSlotFloat64) {
1196 double magic = 3456.375; 1196 double magic = 3456.375;
1197 TestStackSlot(MachineType::Float64(), magic); 1197 TestStackSlot(MachineType::Float64(), magic);
1198 } 1198 }
1199 } // namespace compiler 1199 } // namespace compiler
1200 } // namespace internal 1200 } // namespace internal
1201 } // namespace v8 1201 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-node.cc ('k') | test/cctest/test-ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698