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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 args[0] = arg1; | 516 args[0] = arg1; |
517 args[1] = arg2; | 517 args[1] = arg2; |
518 args[2] = arg3; | 518 args[2] = arg3; |
519 args[3] = arg4; | 519 args[3] = arg4; |
520 args[4] = arg5; | 520 args[4] = arg5; |
521 args[5] = context; | 521 args[5] = context; |
522 | 522 |
523 return CallN(call_descriptor, target, args); | 523 return CallN(call_descriptor, target, args); |
524 } | 524 } |
525 | 525 |
| 526 Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor, |
| 527 Node* target, Node* context, const Arg& arg1, |
| 528 const Arg& arg2, size_t result_size) { |
| 529 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
| 530 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), |
| 531 CallDescriptor::kNoFlags, Operator::kNoProperties, |
| 532 MachineType::AnyTagged(), result_size); |
| 533 |
| 534 const int kArgsCount = 3; |
| 535 Node** args = zone()->NewArray<Node*>(kArgsCount); |
| 536 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); |
| 537 args[arg1.index] = arg1.value; |
| 538 args[arg2.index] = arg2.value; |
| 539 args[kArgsCount - 1] = context; |
| 540 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); |
| 541 |
| 542 return CallN(call_descriptor, target, args); |
| 543 } |
| 544 |
| 545 Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor, |
| 546 Node* target, Node* context, const Arg& arg1, |
| 547 const Arg& arg2, const Arg& arg3, |
| 548 size_t result_size) { |
| 549 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
| 550 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), |
| 551 CallDescriptor::kNoFlags, Operator::kNoProperties, |
| 552 MachineType::AnyTagged(), result_size); |
| 553 |
| 554 const int kArgsCount = 4; |
| 555 Node** args = zone()->NewArray<Node*>(kArgsCount); |
| 556 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); |
| 557 args[arg1.index] = arg1.value; |
| 558 args[arg2.index] = arg2.value; |
| 559 args[arg3.index] = arg3.value; |
| 560 args[kArgsCount - 1] = context; |
| 561 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); |
| 562 |
| 563 return CallN(call_descriptor, target, args); |
| 564 } |
| 565 |
| 566 Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor, |
| 567 Node* target, Node* context, const Arg& arg1, |
| 568 const Arg& arg2, const Arg& arg3, const Arg& arg4, |
| 569 size_t result_size) { |
| 570 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
| 571 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), |
| 572 CallDescriptor::kNoFlags, Operator::kNoProperties, |
| 573 MachineType::AnyTagged(), result_size); |
| 574 |
| 575 const int kArgsCount = 5; |
| 576 Node** args = zone()->NewArray<Node*>(kArgsCount); |
| 577 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); |
| 578 args[arg1.index] = arg1.value; |
| 579 args[arg2.index] = arg2.value; |
| 580 args[arg3.index] = arg3.value; |
| 581 args[arg4.index] = arg4.value; |
| 582 args[kArgsCount - 1] = context; |
| 583 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); |
| 584 |
| 585 return CallN(call_descriptor, target, args); |
| 586 } |
| 587 |
| 588 Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor, |
| 589 Node* target, Node* context, const Arg& arg1, |
| 590 const Arg& arg2, const Arg& arg3, const Arg& arg4, |
| 591 const Arg& arg5, size_t result_size) { |
| 592 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
| 593 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), |
| 594 CallDescriptor::kNoFlags, Operator::kNoProperties, |
| 595 MachineType::AnyTagged(), result_size); |
| 596 |
| 597 const int kArgsCount = 6; |
| 598 Node** args = zone()->NewArray<Node*>(kArgsCount); |
| 599 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); |
| 600 args[arg1.index] = arg1.value; |
| 601 args[arg2.index] = arg2.value; |
| 602 args[arg3.index] = arg3.value; |
| 603 args[arg4.index] = arg4.value; |
| 604 args[arg5.index] = arg5.value; |
| 605 args[kArgsCount - 1] = context; |
| 606 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); |
| 607 |
| 608 return CallN(call_descriptor, target, args); |
| 609 } |
| 610 |
526 Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor, | 611 Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor, |
527 Node* target, Node** args, size_t result_size) { | 612 Node* target, Node** args, size_t result_size) { |
528 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | 613 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
529 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), | 614 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), |
530 CallDescriptor::kNoFlags, Operator::kNoProperties, | 615 CallDescriptor::kNoFlags, Operator::kNoProperties, |
531 MachineType::AnyTagged(), result_size); | 616 MachineType::AnyTagged(), result_size); |
532 | 617 |
533 return CallN(call_descriptor, target, args); | 618 return CallN(call_descriptor, target, args); |
534 } | 619 } |
535 | 620 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 Node** args = zone()->NewArray<Node*>(5); | 700 Node** args = zone()->NewArray<Node*>(5); |
616 args[0] = arg1; | 701 args[0] = arg1; |
617 args[1] = arg2; | 702 args[1] = arg2; |
618 args[2] = arg3; | 703 args[2] = arg3; |
619 args[3] = arg4; | 704 args[3] = arg4; |
620 args[4] = context; | 705 args[4] = context; |
621 | 706 |
622 return raw_assembler_->TailCallN(call_descriptor, target, args); | 707 return raw_assembler_->TailCallN(call_descriptor, target, args); |
623 } | 708 } |
624 | 709 |
| 710 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor, |
| 711 Node* target, Node* context, const Arg& arg1, |
| 712 const Arg& arg2, const Arg& arg3, |
| 713 const Arg& arg4, size_t result_size) { |
| 714 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
| 715 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), |
| 716 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties, |
| 717 MachineType::AnyTagged(), result_size); |
| 718 |
| 719 const int kArgsCount = 5; |
| 720 Node** args = zone()->NewArray<Node*>(kArgsCount); |
| 721 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); |
| 722 args[arg1.index] = arg1.value; |
| 723 args[arg2.index] = arg2.value; |
| 724 args[arg3.index] = arg3.value; |
| 725 args[arg4.index] = arg4.value; |
| 726 args[kArgsCount - 1] = context; |
| 727 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); |
| 728 |
| 729 return raw_assembler_->TailCallN(call_descriptor, target, args); |
| 730 } |
| 731 |
| 732 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor, |
| 733 Node* target, Node* context, const Arg& arg1, |
| 734 const Arg& arg2, const Arg& arg3, |
| 735 const Arg& arg4, const Arg& arg5, |
| 736 size_t result_size) { |
| 737 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
| 738 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), |
| 739 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties, |
| 740 MachineType::AnyTagged(), result_size); |
| 741 |
| 742 const int kArgsCount = 6; |
| 743 Node** args = zone()->NewArray<Node*>(kArgsCount); |
| 744 DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true)); |
| 745 args[arg1.index] = arg1.value; |
| 746 args[arg2.index] = arg2.value; |
| 747 args[arg3.index] = arg3.value; |
| 748 args[arg4.index] = arg4.value; |
| 749 args[arg5.index] = arg5.value; |
| 750 args[kArgsCount - 1] = context; |
| 751 DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr)); |
| 752 |
| 753 return raw_assembler_->TailCallN(call_descriptor, target, args); |
| 754 } |
| 755 |
625 Node* CodeAssembler::TailCallBytecodeDispatch( | 756 Node* CodeAssembler::TailCallBytecodeDispatch( |
626 const CallInterfaceDescriptor& interface_descriptor, | 757 const CallInterfaceDescriptor& interface_descriptor, |
627 Node* code_target_address, Node** args) { | 758 Node* code_target_address, Node** args) { |
628 CallDescriptor* descriptor = Linkage::GetBytecodeDispatchCallDescriptor( | 759 CallDescriptor* descriptor = Linkage::GetBytecodeDispatchCallDescriptor( |
629 isolate(), zone(), interface_descriptor, | 760 isolate(), zone(), interface_descriptor, |
630 interface_descriptor.GetStackParameterCount()); | 761 interface_descriptor.GetStackParameterCount()); |
631 return raw_assembler_->TailCallN(descriptor, code_target_address, args); | 762 return raw_assembler_->TailCallN(descriptor, code_target_address, args); |
632 } | 763 } |
633 | 764 |
634 Node* CodeAssembler::CallJS(Callable const& callable, Node* context, | 765 Node* CodeAssembler::CallJS(Callable const& callable, Node* context, |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 } | 1037 } |
907 } | 1038 } |
908 } | 1039 } |
909 | 1040 |
910 bound_ = true; | 1041 bound_ = true; |
911 } | 1042 } |
912 | 1043 |
913 } // namespace compiler | 1044 } // namespace compiler |
914 } // namespace internal | 1045 } // namespace internal |
915 } // namespace v8 | 1046 } // namespace v8 |
OLD | NEW |