Commit d06495b1 authored by ishell's avatar ishell Committed by Commit bot

[turbofan] Add support for tail-calling a runtime function with 6 arguments.

Review-Url: https://codereview.chromium.org/2317823002
Cr-Commit-Position: refs/heads/master@{#39241}
parent 00fbef89
...@@ -432,6 +432,14 @@ Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function_id, ...@@ -432,6 +432,14 @@ Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function_id,
arg5, context); arg5, context);
} }
Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function_id,
Node* context, Node* arg1, Node* arg2,
Node* arg3, Node* arg4, Node* arg5,
Node* arg6) {
return raw_assembler_->TailCallRuntime6(function_id, arg1, arg2, arg3, arg4,
arg5, arg6, context);
}
Node* CodeAssembler::CallStub(Callable const& callable, Node* context, Node* CodeAssembler::CallStub(Callable const& callable, Node* context,
Node* arg1, size_t result_size) { Node* arg1, size_t result_size) {
Node* target = HeapConstant(callable.code()); Node* target = HeapConstant(callable.code());
......
...@@ -56,6 +56,7 @@ class RawMachineLabel; ...@@ -56,6 +56,7 @@ class RawMachineLabel;
V(Uint32LessThan) \ V(Uint32LessThan) \
V(Uint32GreaterThanOrEqual) \ V(Uint32GreaterThanOrEqual) \
V(UintPtrLessThan) \ V(UintPtrLessThan) \
V(UintPtrGreaterThan) \
V(UintPtrGreaterThanOrEqual) \ V(UintPtrGreaterThanOrEqual) \
V(WordEqual) \ V(WordEqual) \
V(WordNotEqual) \ V(WordNotEqual) \
...@@ -319,6 +320,9 @@ class CodeAssembler { ...@@ -319,6 +320,9 @@ class CodeAssembler {
Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context, Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context,
Node* arg1, Node* arg2, Node* arg3, Node* arg4, Node* arg1, Node* arg2, Node* arg3, Node* arg4,
Node* arg5); Node* arg5);
Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context,
Node* arg1, Node* arg2, Node* arg3, Node* arg4,
Node* arg5, Node* arg6);
// A pair of a zero-based argument index and a value. // A pair of a zero-based argument index and a value.
// It helps writing arguments order independent code. // It helps writing arguments order independent code.
......
...@@ -402,6 +402,30 @@ Node* RawMachineAssembler::TailCallRuntime5(Runtime::FunctionId function, ...@@ -402,6 +402,30 @@ Node* RawMachineAssembler::TailCallRuntime5(Runtime::FunctionId function,
return tail_call; return tail_call;
} }
Node* RawMachineAssembler::TailCallRuntime6(Runtime::FunctionId function,
Node* arg1, Node* arg2, Node* arg3,
Node* arg4, Node* arg5, Node* arg6,
Node* context) {
const int kArity = 6;
CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
zone(), function, kArity, Operator::kNoProperties,
CallDescriptor::kSupportsTailCalls);
int return_count = static_cast<int>(desc->ReturnCount());
Node* centry = HeapConstant(CEntryStub(isolate(), return_count).GetCode());
Node* ref = AddNode(
common()->ExternalConstant(ExternalReference(function, isolate())));
Node* arity = Int32Constant(kArity);
Node* nodes[] = {centry, arg1, arg2, arg3, arg4,
arg5, arg6, ref, arity, context};
Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes);
schedule()->AddTailCall(CurrentBlock(), tail_call);
current_block_ = nullptr;
return tail_call;
}
Node* RawMachineAssembler::CallCFunction0(MachineType return_type, Node* RawMachineAssembler::CallCFunction0(MachineType return_type,
Node* function) { Node* function) {
MachineSignature::Builder builder(zone(), 1, 0); MachineSignature::Builder builder(zone(), 1, 0);
......
...@@ -744,6 +744,10 @@ class RawMachineAssembler { ...@@ -744,6 +744,10 @@ class RawMachineAssembler {
// Tail call to a runtime function with five arguments. // Tail call to a runtime function with five arguments.
Node* TailCallRuntime5(Runtime::FunctionId function, Node* arg1, Node* arg2, Node* TailCallRuntime5(Runtime::FunctionId function, Node* arg1, Node* arg2,
Node* arg3, Node* arg4, Node* arg5, Node* context); Node* arg3, Node* arg4, Node* arg5, Node* context);
// Tail call to a runtime function with six arguments.
Node* TailCallRuntime6(Runtime::FunctionId function, Node* arg1, Node* arg2,
Node* arg3, Node* arg4, Node* arg5, Node* arg6,
Node* context);
// =========================================================================== // ===========================================================================
// The following utility methods deal with control flow, hence might switch // The following utility methods deal with control flow, hence might switch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment