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

Side by Side Diff: src/compiler/common-operator.cc

Issue 1114163005: [turbofan] Fix tail call optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/base/lazy-instance.h" 8 #include "src/base/lazy-instance.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 IrOpcode::kFrameState, Operator::kPure, // opcode 655 IrOpcode::kFrameState, Operator::kPure, // opcode
656 "FrameState", // name 656 "FrameState", // name
657 4, 0, 0, 1, 0, 0, // counts 657 4, 0, 0, 1, 0, 0, // counts
658 FrameStateCallInfo(type, bailout_id, state_combine, jsfunction)); 658 FrameStateCallInfo(type, bailout_id, state_combine, jsfunction));
659 } 659 }
660 660
661 661
662 const Operator* CommonOperatorBuilder::Call(const CallDescriptor* descriptor) { 662 const Operator* CommonOperatorBuilder::Call(const CallDescriptor* descriptor) {
663 class CallOperator final : public Operator1<const CallDescriptor*> { 663 class CallOperator final : public Operator1<const CallDescriptor*> {
664 public: 664 public:
665 CallOperator(const CallDescriptor* descriptor, const char* mnemonic) 665 explicit CallOperator(const CallDescriptor* descriptor)
666 : Operator1<const CallDescriptor*>( 666 : Operator1<const CallDescriptor*>(
667 IrOpcode::kCall, descriptor->properties(), mnemonic, 667 IrOpcode::kCall, descriptor->properties(), "Call",
668 descriptor->InputCount() + descriptor->FrameStateCount(), 668 descriptor->InputCount() + descriptor->FrameStateCount(),
669 Operator::ZeroIfPure(descriptor->properties()), 669 Operator::ZeroIfPure(descriptor->properties()),
670 Operator::ZeroIfEliminatable(descriptor->properties()), 670 Operator::ZeroIfEliminatable(descriptor->properties()),
671 descriptor->ReturnCount(), 671 descriptor->ReturnCount(),
672 Operator::ZeroIfPure(descriptor->properties()), 672 Operator::ZeroIfPure(descriptor->properties()),
673 Operator::ZeroIfNoThrow(descriptor->properties()), descriptor) {} 673 Operator::ZeroIfNoThrow(descriptor->properties()), descriptor) {}
674 674
675 void PrintParameter(std::ostream& os) const override { 675 void PrintParameter(std::ostream& os) const override {
676 os << "[" << *parameter() << "]"; 676 os << "[" << *parameter() << "]";
677 } 677 }
678 }; 678 };
679 return new (zone()) CallOperator(descriptor, "Call"); 679 return new (zone()) CallOperator(descriptor);
680 } 680 }
681 681
682 682
683 const Operator* CommonOperatorBuilder::TailCall(
684 const CallDescriptor* descriptor) {
685 class TailCallOperator final : public Operator1<const CallDescriptor*> {
686 public:
687 explicit TailCallOperator(const CallDescriptor* descriptor)
688 : Operator1<const CallDescriptor*>(
689 IrOpcode::kTailCall, descriptor->properties(), "TailCall",
690 descriptor->InputCount() + descriptor->FrameStateCount(), 1, 1, 0,
691 0, 1, descriptor) {}
692
693 void PrintParameter(std::ostream& os) const override {
694 os << "[" << *parameter() << "]";
695 }
696 };
697 return new (zone()) TailCallOperator(descriptor);
698 }
699
700
683 const Operator* CommonOperatorBuilder::Projection(size_t index) { 701 const Operator* CommonOperatorBuilder::Projection(size_t index) {
684 switch (index) { 702 switch (index) {
685 #define CACHED_PROJECTION(index) \ 703 #define CACHED_PROJECTION(index) \
686 case index: \ 704 case index: \
687 return &cache_.kProjection##index##Operator; 705 return &cache_.kProjection##index##Operator;
688 CACHED_PROJECTION_LIST(CACHED_PROJECTION) 706 CACHED_PROJECTION_LIST(CACHED_PROJECTION)
689 #undef CACHED_PROJECTION 707 #undef CACHED_PROJECTION
690 default: 708 default:
691 break; 709 break;
692 } 710 }
(...skipping 20 matching lines...) Expand all
713 } else { 731 } else {
714 UNREACHABLE(); 732 UNREACHABLE();
715 return nullptr; 733 return nullptr;
716 } 734 }
717 } 735 }
718 736
719 737
720 } // namespace compiler 738 } // namespace compiler
721 } // namespace internal 739 } // namespace internal
722 } // namespace v8 740 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698