[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}
This commit is contained in:
ishell 2016-09-07 03:12:52 -07:00 committed by Commit bot
parent 00fbef8961
commit d06495b190
4 changed files with 40 additions and 0 deletions

View File

@ -432,6 +432,14 @@ Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function_id,
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* arg1, size_t result_size) {
Node* target = HeapConstant(callable.code());

View File

@ -56,6 +56,7 @@ class RawMachineLabel;
V(Uint32LessThan) \
V(Uint32GreaterThanOrEqual) \
V(UintPtrLessThan) \
V(UintPtrGreaterThan) \
V(UintPtrGreaterThanOrEqual) \
V(WordEqual) \
V(WordNotEqual) \
@ -319,6 +320,9 @@ class CodeAssembler {
Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context,
Node* arg1, Node* arg2, Node* arg3, Node* arg4,
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.
// It helps writing arguments order independent code.

View File

@ -402,6 +402,30 @@ Node* RawMachineAssembler::TailCallRuntime5(Runtime::FunctionId function,
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* function) {
MachineSignature::Builder builder(zone(), 1, 0);

View File

@ -744,6 +744,10 @@ class RawMachineAssembler {
// Tail call to a runtime function with five arguments.
Node* TailCallRuntime5(Runtime::FunctionId function, Node* arg1, Node* arg2,
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