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/compiler/code-assembler.h" | 5 #include "src/compiler/code-assembler.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 args[arg3.index] = arg3.value; | 650 args[arg3.index] = arg3.value; |
651 args[arg4.index] = arg4.value; | 651 args[arg4.index] = arg4.value; |
652 args[arg5.index] = arg5.value; | 652 args[arg5.index] = arg5.value; |
653 args[kArgsCount - 1] = context; | 653 args[kArgsCount - 1] = context; |
654 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); | 654 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); |
655 | 655 |
656 return CallN(call_descriptor, target, args); | 656 return CallN(call_descriptor, target, args); |
657 } | 657 } |
658 | 658 |
659 Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor, | 659 Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor, |
660 Node* target, Node** args, size_t result_size) { | 660 int js_parameter_count, Node* target, |
| 661 Node** args, size_t result_size) { |
661 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | 662 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
662 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), | 663 isolate(), zone(), descriptor, |
| 664 descriptor.GetStackParameterCount() + js_parameter_count, |
663 CallDescriptor::kNoFlags, Operator::kNoProperties, | 665 CallDescriptor::kNoFlags, Operator::kNoProperties, |
664 MachineType::AnyTagged(), result_size); | 666 MachineType::AnyTagged(), result_size); |
665 | 667 |
666 return CallN(call_descriptor, target, args); | 668 return CallN(call_descriptor, target, args); |
667 } | 669 } |
668 | 670 |
669 Node* CodeAssembler::TailCallStub(Callable const& callable, Node* context, | 671 Node* CodeAssembler::TailCallStub(Callable const& callable, Node* context, |
670 Node* arg1, size_t result_size) { | 672 Node* arg1, size_t result_size) { |
671 Node* target = HeapConstant(callable.code()); | 673 Node* target = HeapConstant(callable.code()); |
672 return TailCallStub(callable.descriptor(), target, context, arg1, | 674 return TailCallStub(callable.descriptor(), target, context, arg1, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 CallDescriptor* descriptor = Linkage::GetBytecodeDispatchCallDescriptor( | 817 CallDescriptor* descriptor = Linkage::GetBytecodeDispatchCallDescriptor( |
816 isolate(), zone(), interface_descriptor, | 818 isolate(), zone(), interface_descriptor, |
817 interface_descriptor.GetStackParameterCount()); | 819 interface_descriptor.GetStackParameterCount()); |
818 return raw_assembler_->TailCallN(descriptor, code_target_address, args); | 820 return raw_assembler_->TailCallN(descriptor, code_target_address, args); |
819 } | 821 } |
820 | 822 |
821 Node* CodeAssembler::CallJS(Callable const& callable, Node* context, | 823 Node* CodeAssembler::CallJS(Callable const& callable, Node* context, |
822 Node* function, Node* receiver, | 824 Node* function, Node* receiver, |
823 size_t result_size) { | 825 size_t result_size) { |
824 const int argc = 0; | 826 const int argc = 0; |
825 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | |
826 isolate(), zone(), callable.descriptor(), argc + 1, | |
827 CallDescriptor::kNoFlags, Operator::kNoProperties, | |
828 MachineType::AnyTagged(), result_size); | |
829 Node* target = HeapConstant(callable.code()); | 827 Node* target = HeapConstant(callable.code()); |
830 | 828 |
831 Node** args = zone()->NewArray<Node*>(argc + 4); | 829 Node** args = zone()->NewArray<Node*>(argc + 4); |
832 args[0] = function; | 830 args[0] = function; |
833 args[1] = Int32Constant(argc); | 831 args[1] = Int32Constant(argc); |
834 args[2] = receiver; | 832 args[2] = receiver; |
835 args[3] = context; | 833 args[3] = context; |
836 | 834 |
837 return CallN(call_descriptor, target, args); | 835 return CallStubN(callable.descriptor(), argc + 1, target, args, result_size); |
838 } | 836 } |
839 | 837 |
840 Node* CodeAssembler::CallJS(Callable const& callable, Node* context, | 838 Node* CodeAssembler::CallJS(Callable const& callable, Node* context, |
841 Node* function, Node* receiver, Node* arg1, | 839 Node* function, Node* receiver, Node* arg1, |
842 size_t result_size) { | 840 size_t result_size) { |
843 const int argc = 1; | 841 const int argc = 1; |
844 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | |
845 isolate(), zone(), callable.descriptor(), argc + 1, | |
846 CallDescriptor::kNoFlags, Operator::kNoProperties, | |
847 MachineType::AnyTagged(), result_size); | |
848 Node* target = HeapConstant(callable.code()); | 842 Node* target = HeapConstant(callable.code()); |
849 | 843 |
850 Node** args = zone()->NewArray<Node*>(argc + 4); | 844 Node** args = zone()->NewArray<Node*>(argc + 4); |
851 args[0] = function; | 845 args[0] = function; |
852 args[1] = Int32Constant(argc); | 846 args[1] = Int32Constant(argc); |
853 args[2] = receiver; | 847 args[2] = receiver; |
854 args[3] = arg1; | 848 args[3] = arg1; |
855 args[4] = context; | 849 args[4] = context; |
856 | 850 |
857 return CallN(call_descriptor, target, args); | 851 return CallStubN(callable.descriptor(), argc + 1, target, args, result_size); |
858 } | 852 } |
859 | 853 |
860 Node* CodeAssembler::CallJS(Callable const& callable, Node* context, | 854 Node* CodeAssembler::CallJS(Callable const& callable, Node* context, |
861 Node* function, Node* receiver, Node* arg1, | 855 Node* function, Node* receiver, Node* arg1, |
862 Node* arg2, size_t result_size) { | 856 Node* arg2, size_t result_size) { |
863 const int argc = 2; | 857 const int argc = 2; |
864 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | |
865 isolate(), zone(), callable.descriptor(), argc + 1, | |
866 CallDescriptor::kNoFlags, Operator::kNoProperties, | |
867 MachineType::AnyTagged(), result_size); | |
868 Node* target = HeapConstant(callable.code()); | 858 Node* target = HeapConstant(callable.code()); |
869 | 859 |
870 Node** args = zone()->NewArray<Node*>(argc + 4); | 860 Node** args = zone()->NewArray<Node*>(argc + 4); |
871 args[0] = function; | 861 args[0] = function; |
872 args[1] = Int32Constant(argc); | 862 args[1] = Int32Constant(argc); |
873 args[2] = receiver; | 863 args[2] = receiver; |
874 args[3] = arg1; | 864 args[3] = arg1; |
875 args[4] = arg2; | 865 args[4] = arg2; |
876 args[5] = context; | 866 args[5] = context; |
877 | 867 |
878 return CallN(call_descriptor, target, args); | 868 return CallStubN(callable.descriptor(), argc + 1, target, args, result_size); |
879 } | 869 } |
880 | 870 |
881 Node* CodeAssembler::CallCFunction2(MachineType return_type, | 871 Node* CodeAssembler::CallCFunction2(MachineType return_type, |
882 MachineType arg0_type, | 872 MachineType arg0_type, |
883 MachineType arg1_type, Node* function, | 873 MachineType arg1_type, Node* function, |
884 Node* arg0, Node* arg1) { | 874 Node* arg0, Node* arg1) { |
885 return raw_assembler_->CallCFunction2(return_type, arg0_type, arg1_type, | 875 return raw_assembler_->CallCFunction2(return_type, arg0_type, arg1_type, |
886 function, arg0, arg1); | 876 function, arg0, arg1); |
887 } | 877 } |
888 | 878 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 } | 1089 } |
1100 } | 1090 } |
1101 } | 1091 } |
1102 | 1092 |
1103 bound_ = true; | 1093 bound_ = true; |
1104 } | 1094 } |
1105 | 1095 |
1106 } // namespace compiler | 1096 } // namespace compiler |
1107 } // namespace internal | 1097 } // namespace internal |
1108 } // namespace v8 | 1098 } // namespace v8 |
OLD | NEW |