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

Side by Side Diff: src/compiler/code-assembler.cc

Issue 2584743003: [turbofan] Combine family of TailCallStub() methods into single implementation. (Closed)
Patch Set: Created 4 years 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 | « src/compiler/code-assembler.h ('k') | no next file » | 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/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
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 Node* CodeAssembler::TailCallStub(Callable const& callable, Node* context, 516 template <class... TArgs>
517 Node* arg1, size_t result_size) {
518 Node* target = HeapConstant(callable.code());
519 return TailCallStub(callable.descriptor(), target, context, arg1,
520 result_size);
521 }
522
523 Node* CodeAssembler::TailCallStub(Callable const& callable, Node* context,
524 Node* arg1, Node* arg2, size_t result_size) {
525 Node* target = HeapConstant(callable.code());
526 return TailCallStub(callable.descriptor(), target, context, arg1, arg2,
527 result_size);
528 }
529
530 Node* CodeAssembler::TailCallStub(Callable const& callable, Node* context,
531 Node* arg1, Node* arg2, Node* arg3,
532 size_t result_size) {
533 Node* target = HeapConstant(callable.code());
534 return TailCallStub(callable.descriptor(), target, context, arg1, arg2, arg3,
535 result_size);
536 }
537
538 Node* CodeAssembler::TailCallStub(Callable const& callable, Node* context,
539 Node* arg1, Node* arg2, Node* arg3,
540 Node* arg4, size_t result_size) {
541 Node* target = HeapConstant(callable.code());
542 return TailCallStub(callable.descriptor(), target, context, arg1, arg2, arg3,
543 arg4, result_size);
544 }
545
546 Node* CodeAssembler::TailCallStub(Callable const& callable, Node* context,
547 Node* arg1, Node* arg2, Node* arg3,
548 Node* arg4, Node* arg5, size_t result_size) {
549 Node* target = HeapConstant(callable.code());
550 return TailCallStub(callable.descriptor(), target, context, arg1, arg2, arg3,
551 arg4, arg5, result_size);
552 }
553
554 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor, 517 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
555 Node* target, Node* context, Node* arg1, 518 Node* target, Node* context, TArgs... args) {
556 size_t result_size) { 519 DCHECK_EQ(descriptor.GetParameterCount(), sizeof...(args));
557 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( 520 size_t result_size = 1;
521 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
558 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), 522 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
559 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties, 523 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties,
560 MachineType::AnyTagged(), result_size); 524 MachineType::AnyTagged(), result_size);
561 525
562 Node** args = zone()->NewArray<Node*>(2); 526 Node* nodes[] = {target, args..., context};
563 args[0] = arg1;
564 args[1] = context;
565 527
566 return raw_assembler()->TailCallN(call_descriptor, target, args); 528 return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes);
567 } 529 }
568 530
569 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor, 531 // Instantiate TailCallStub() with up to 6 arguments.
570 Node* target, Node* context, Node* arg1, 532 #define INSTANTIATE(...) \
571 Node* arg2, size_t result_size) { 533 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallStub( \
572 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( 534 const CallInterfaceDescriptor& descriptor, Node*, __VA_ARGS__);
573 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(), 535 REPEAT_1_TO_7(INSTANTIATE, Node*)
574 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties, 536 #undef INSTANTIATE
575 MachineType::AnyTagged(), result_size);
576
577 Node** args = zone()->NewArray<Node*>(3);
578 args[0] = arg1;
579 args[1] = arg2;
580 args[2] = context;
581
582 return raw_assembler()->TailCallN(call_descriptor, target, args);
583 }
584
585 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
586 Node* target, Node* context, Node* arg1,
587 Node* arg2, Node* arg3, size_t result_size) {
588 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
589 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
590 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties,
591 MachineType::AnyTagged(), result_size);
592
593 Node** args = zone()->NewArray<Node*>(4);
594 args[0] = arg1;
595 args[1] = arg2;
596 args[2] = arg3;
597 args[3] = context;
598
599 return raw_assembler()->TailCallN(call_descriptor, target, args);
600 }
601
602 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
603 Node* target, Node* context, Node* arg1,
604 Node* arg2, Node* arg3, Node* arg4,
605 size_t result_size) {
606 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
607 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
608 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties,
609 MachineType::AnyTagged(), result_size);
610
611 Node** args = zone()->NewArray<Node*>(5);
612 args[0] = arg1;
613 args[1] = arg2;
614 args[2] = arg3;
615 args[3] = arg4;
616 args[4] = context;
617
618 return raw_assembler()->TailCallN(call_descriptor, target, args);
619 }
620
621 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
622 Node* target, Node* context, Node* arg1,
623 Node* arg2, Node* arg3, Node* arg4,
624 Node* arg5, size_t result_size) {
625 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
626 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
627 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties,
628 MachineType::AnyTagged(), result_size);
629
630 Node** args = zone()->NewArray<Node*>(6);
631 args[0] = arg1;
632 args[1] = arg2;
633 args[2] = arg3;
634 args[3] = arg4;
635 args[4] = arg5;
636 args[5] = context;
637
638 return raw_assembler()->TailCallN(call_descriptor, target, args);
639 }
640
641 Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
642 Node* target, Node* context, Node* arg1,
643 Node* arg2, Node* arg3, Node* arg4,
644 Node* arg5, Node* arg6, size_t result_size) {
645 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
646 isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
647 CallDescriptor::kSupportsTailCalls, Operator::kNoProperties,
648 MachineType::AnyTagged(), result_size);
649
650 Node** args = zone()->NewArray<Node*>(7);
651 args[0] = arg1;
652 args[1] = arg2;
653 args[2] = arg3;
654 args[3] = arg4;
655 args[4] = arg5;
656 args[5] = arg6;
657 args[6] = context;
658
659 return raw_assembler()->TailCallN(call_descriptor, target, args);
660 }
661 537
662 Node* CodeAssembler::TailCallBytecodeDispatch( 538 Node* CodeAssembler::TailCallBytecodeDispatch(
663 const CallInterfaceDescriptor& interface_descriptor, 539 const CallInterfaceDescriptor& interface_descriptor,
664 Node* code_target_address, Node** args) { 540 Node* code_target_address, Node** args) {
665 CallDescriptor* descriptor = Linkage::GetBytecodeDispatchCallDescriptor( 541 CallDescriptor* descriptor = Linkage::GetBytecodeDispatchCallDescriptor(
666 isolate(), zone(), interface_descriptor, 542 isolate(), zone(), interface_descriptor,
667 interface_descriptor.GetStackParameterCount()); 543 interface_descriptor.GetStackParameterCount());
668 return raw_assembler()->TailCallN(descriptor, code_target_address, args); 544 return raw_assembler()->TailCallN(descriptor, code_target_address, args);
669 } 545 }
670 546
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 } 750 }
875 } 751 }
876 } 752 }
877 753
878 bound_ = true; 754 bound_ = true;
879 } 755 }
880 756
881 } // namespace compiler 757 } // namespace compiler
882 } // namespace internal 758 } // namespace internal
883 } // namespace v8 759 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698