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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/common-operator.cc
diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc
index 0c1361511a42a98f9fa16231488b21a2989cbf89..3a7ce3993dcdcb0ff7c46123cd0d626a1212b2b7 100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -662,9 +662,9 @@ const Operator* CommonOperatorBuilder::FrameState(
const Operator* CommonOperatorBuilder::Call(const CallDescriptor* descriptor) {
class CallOperator final : public Operator1<const CallDescriptor*> {
public:
- CallOperator(const CallDescriptor* descriptor, const char* mnemonic)
+ explicit CallOperator(const CallDescriptor* descriptor)
: Operator1<const CallDescriptor*>(
- IrOpcode::kCall, descriptor->properties(), mnemonic,
+ IrOpcode::kCall, descriptor->properties(), "Call",
descriptor->InputCount() + descriptor->FrameStateCount(),
Operator::ZeroIfPure(descriptor->properties()),
Operator::ZeroIfEliminatable(descriptor->properties()),
@@ -676,7 +676,25 @@ const Operator* CommonOperatorBuilder::Call(const CallDescriptor* descriptor) {
os << "[" << *parameter() << "]";
}
};
- return new (zone()) CallOperator(descriptor, "Call");
+ return new (zone()) CallOperator(descriptor);
+}
+
+
+const Operator* CommonOperatorBuilder::TailCall(
+ const CallDescriptor* descriptor) {
+ class TailCallOperator final : public Operator1<const CallDescriptor*> {
+ public:
+ explicit TailCallOperator(const CallDescriptor* descriptor)
+ : Operator1<const CallDescriptor*>(
+ IrOpcode::kTailCall, descriptor->properties(), "TailCall",
+ descriptor->InputCount() + descriptor->FrameStateCount(), 1, 1, 0,
+ 0, 1, descriptor) {}
+
+ void PrintParameter(std::ostream& os) const override {
+ os << "[" << *parameter() << "]";
+ }
+ };
+ return new (zone()) TailCallOperator(descriptor);
}

Powered by Google App Engine
This is Rietveld 408576698