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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 isolate(), zone(), descriptor, stack_parameter_count, | 506 isolate(), zone(), descriptor, stack_parameter_count, |
507 CallDescriptor::kNoFlags, Operator::kNoProperties, | 507 CallDescriptor::kNoFlags, Operator::kNoProperties, |
508 MachineType::AnyTagged(), result_size); | 508 MachineType::AnyTagged(), result_size); |
509 | 509 |
510 CallPrologue(); | 510 CallPrologue(); |
511 Node* return_value = raw_assembler()->CallN(desc, input_count, inputs); | 511 Node* return_value = raw_assembler()->CallN(desc, input_count, inputs); |
512 CallEpilogue(); | 512 CallEpilogue(); |
513 return return_value; | 513 return return_value; |
514 } | 514 } |
515 | 515 |
516 | |
517 Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor, | |
518 Node* target, Node* context, const Arg& arg1, | |
519 const Arg& arg2, size_t result_size) { | |
520 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | |
521 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), | |
522 CallDescriptor::kNoFlags, Operator::kNoProperties, | |
523 MachineType::AnyTagged(), result_size); | |
524 | |
525 const int kArgsCount = 3; | |
526 Node** args = zone()->NewArray<Node*>(kArgsCount); | |
527 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); | |
528 args[arg1.index] = arg1.value; | |
529 args[arg2.index] = arg2.value; | |
530 args[kArgsCount - 1] = context; | |
531 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); | |
532 | |
533 return CallN(call_descriptor, target, args); | |
534 } | |
535 | |
536 Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor, | |
537 Node* target, Node* context, const Arg& arg1, | |
538 const Arg& arg2, const Arg& arg3, | |
539 size_t result_size) { | |
540 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | |
541 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), | |
542 CallDescriptor::kNoFlags, Operator::kNoProperties, | |
543 MachineType::AnyTagged(), result_size); | |
544 | |
545 const int kArgsCount = 4; | |
546 Node** args = zone()->NewArray<Node*>(kArgsCount); | |
547 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); | |
548 args[arg1.index] = arg1.value; | |
549 args[arg2.index] = arg2.value; | |
550 args[arg3.index] = arg3.value; | |
551 args[kArgsCount - 1] = context; | |
552 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); | |
553 | |
554 return CallN(call_descriptor, target, args); | |
555 } | |
556 | |
557 Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor, | |
558 Node* target, Node* context, const Arg& arg1, | |
559 const Arg& arg2, const Arg& arg3, const Arg& arg4, | |
560 size_t result_size) { | |
561 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | |
562 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), | |
563 CallDescriptor::kNoFlags, Operator::kNoProperties, | |
564 MachineType::AnyTagged(), result_size); | |
565 | |
566 const int kArgsCount = 5; | |
567 Node** args = zone()->NewArray<Node*>(kArgsCount); | |
568 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); | |
569 args[arg1.index] = arg1.value; | |
570 args[arg2.index] = arg2.value; | |
571 args[arg3.index] = arg3.value; | |
572 args[arg4.index] = arg4.value; | |
573 args[kArgsCount - 1] = context; | |
574 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); | |
575 | |
576 return CallN(call_descriptor, target, args); | |
577 } | |
578 | |
579 Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor, | |
580 Node* target, Node* context, const Arg& arg1, | |
581 const Arg& arg2, const Arg& arg3, const Arg& arg4, | |
582 const Arg& arg5, size_t result_size) { | |
583 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | |
584 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), | |
585 CallDescriptor::kNoFlags, Operator::kNoProperties, | |
586 MachineType::AnyTagged(), result_size); | |
587 | |
588 const int kArgsCount = 6; | |
589 Node** args = zone()->NewArray<Node*>(kArgsCount); | |
590 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); | |
591 args[arg1.index] = arg1.value; | |
592 args[arg2.index] = arg2.value; | |
593 args[arg3.index] = arg3.value; | |
594 args[arg4.index] = arg4.value; | |
595 args[arg5.index] = arg5.value; | |
596 args[kArgsCount - 1] = context; | |
597 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); | |
598 | |
599 return CallN(call_descriptor, target, args); | |
600 } | |
601 | |
602 Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor, | 516 Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor, |
603 int js_parameter_count, Node* target, | 517 int js_parameter_count, Node* target, |
604 Node** args, size_t result_size) { | 518 Node** args, size_t result_size) { |
605 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | 519 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
606 isolate(), zone(), descriptor, | 520 isolate(), zone(), descriptor, |
607 descriptor.GetStackParameterCount() + js_parameter_count, | 521 descriptor.GetStackParameterCount() + js_parameter_count, |
608 CallDescriptor::kNoFlags, Operator::kNoProperties, | 522 CallDescriptor::kNoFlags, Operator::kNoProperties, |
609 MachineType::AnyTagged(), result_size); | 523 MachineType::AnyTagged(), result_size); |
610 | 524 |
611 return CallN(call_descriptor, target, args); | 525 return CallN(call_descriptor, target, args); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 args[1] = arg2; | 664 args[1] = arg2; |
751 args[2] = arg3; | 665 args[2] = arg3; |
752 args[3] = arg4; | 666 args[3] = arg4; |
753 args[4] = arg5; | 667 args[4] = arg5; |
754 args[5] = arg6; | 668 args[5] = arg6; |
755 args[6] = context; | 669 args[6] = context; |
756 | 670 |
757 return raw_assembler()->TailCallN(call_descriptor, target, args); | 671 return raw_assembler()->TailCallN(call_descriptor, target, args); |
758 } | 672 } |
759 | 673 |
760 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor, | |
761 Node* target, Node* context, const Arg& arg1, | |
762 const Arg& arg2, const Arg& arg3, | |
763 const Arg& arg4, size_t result_size) { | |
764 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | |
765 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), | |
766 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties, | |
767 MachineType::AnyTagged(), result_size); | |
768 | |
769 const int kArgsCount = 5; | |
770 Node** args = zone()->NewArray<Node*>(kArgsCount); | |
771 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); | |
772 args[arg1.index] = arg1.value; | |
773 args[arg2.index] = arg2.value; | |
774 args[arg3.index] = arg3.value; | |
775 args[arg4.index] = arg4.value; | |
776 args[kArgsCount - 1] = context; | |
777 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); | |
778 | |
779 return raw_assembler()->TailCallN(call_descriptor, target, args); | |
780 } | |
781 | |
782 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor, | |
783 Node* target, Node* context, const Arg& arg1, | |
784 const Arg& arg2, const Arg& arg3, | |
785 const Arg& arg4, const Arg& arg5, | |
786 size_t result_size) { | |
787 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | |
788 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), | |
789 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties, | |
790 MachineType::AnyTagged(), result_size); | |
791 | |
792 const int kArgsCount = 6; | |
793 Node** args = zone()->NewArray<Node*>(kArgsCount); | |
794 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); | |
795 args[arg1.index] = arg1.value; | |
796 args[arg2.index] = arg2.value; | |
797 args[arg3.index] = arg3.value; | |
798 args[arg4.index] = arg4.value; | |
799 args[arg5.index] = arg5.value; | |
800 args[kArgsCount - 1] = context; | |
801 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); | |
802 | |
803 return raw_assembler()->TailCallN(call_descriptor, target, args); | |
804 } | |
805 | |
806 Node* CodeAssembler::TailCallBytecodeDispatch( | 674 Node* CodeAssembler::TailCallBytecodeDispatch( |
807 const CallInterfaceDescriptor& interface_descriptor, | 675 const CallInterfaceDescriptor& interface_descriptor, |
808 Node* code_target_address, Node** args) { | 676 Node* code_target_address, Node** args) { |
809 CallDescriptor* descriptor = Linkage::GetBytecodeDispatchCallDescriptor( | 677 CallDescriptor* descriptor = Linkage::GetBytecodeDispatchCallDescriptor( |
810 isolate(), zone(), interface_descriptor, | 678 isolate(), zone(), interface_descriptor, |
811 interface_descriptor.GetStackParameterCount()); | 679 interface_descriptor.GetStackParameterCount()); |
812 return raw_assembler()->TailCallN(descriptor, code_target_address, args); | 680 return raw_assembler()->TailCallN(descriptor, code_target_address, args); |
813 } | 681 } |
814 | 682 |
815 Node* CodeAssembler::CallJS(Callable const& callable, Node* context, | 683 Node* CodeAssembler::CallJS(Callable const& callable, Node* context, |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 } | 952 } |
1085 } | 953 } |
1086 } | 954 } |
1087 | 955 |
1088 bound_ = true; | 956 bound_ = true; |
1089 } | 957 } |
1090 | 958 |
1091 } // namespace compiler | 959 } // namespace compiler |
1092 } // namespace internal | 960 } // namespace internal |
1093 } // namespace v8 | 961 } // namespace v8 |
OLD | NEW |