Chromium Code Reviews| Index: src/compiler/raw-machine-assembler.cc |
| diff --git a/src/compiler/raw-machine-assembler.cc b/src/compiler/raw-machine-assembler.cc |
| index b88fe8c4f07486b9ed93668d603a8b891990c3b9..86975f31a89a6edaf658556ed03200f7d8ec04fb 100644 |
| --- a/src/compiler/raw-machine-assembler.cc |
| +++ b/src/compiler/raw-machine-assembler.cc |
| @@ -152,31 +152,10 @@ Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc, |
| } |
| -Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function, |
| - Node** args) { |
| - int param_count = |
| - static_cast<int>(desc->GetMachineSignature()->parameter_count()); |
| - int input_count = param_count + 3; |
| - Node** buffer = zone()->NewArray<Node*>(input_count); |
| - int index = 0; |
| - buffer[index++] = function; |
| - for (int i = 0; i < param_count; i++) { |
| - buffer[index++] = args[i]; |
| - } |
| - buffer[index++] = graph()->start(); |
| - buffer[index++] = graph()->start(); |
| - Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer); |
| - schedule()->AddTailCall(CurrentBlock(), tail_call); |
| - current_block_ = nullptr; |
| - return tail_call; |
| -} |
| - |
| - |
| Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, |
| Node* arg1, Node* context) { |
| CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( |
| - zone(), function, 1, Operator::kNoProperties, false); |
| - |
|
Michael Starzinger
2015/12/01 18:06:53
nit: Bring back empty newline just for consistency
danno
2015/12/02 07:00:19
Done.
|
| + zone(), function, 1, Operator::kNoProperties, CallDescriptor::kNoFlags); |
| Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); |
| Node* ref = AddNode( |
| common()->ExternalConstant(ExternalReference(function, isolate()))); |
| @@ -190,7 +169,7 @@ Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, |
| Node* RawMachineAssembler::CallRuntime2(Runtime::FunctionId function, |
| Node* arg1, Node* arg2, Node* context) { |
| CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( |
| - zone(), function, 2, Operator::kNoProperties, false); |
| + zone(), function, 2, Operator::kNoProperties, CallDescriptor::kNoFlags); |
| Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); |
| Node* ref = AddNode( |
| @@ -206,7 +185,7 @@ Node* RawMachineAssembler::CallRuntime4(Runtime::FunctionId function, |
| Node* arg1, Node* arg2, Node* arg3, |
| Node* arg4, Node* context) { |
| CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( |
| - zone(), function, 4, Operator::kNoProperties, false); |
| + zone(), function, 4, Operator::kNoProperties, CallDescriptor::kNoFlags); |
| Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); |
| Node* ref = AddNode( |
| @@ -218,6 +197,72 @@ Node* RawMachineAssembler::CallRuntime4(Runtime::FunctionId function, |
| } |
| +Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function, |
| + Node** args) { |
| + int param_count = |
| + static_cast<int>(desc->GetMachineSignature()->parameter_count()); |
| + int input_count = param_count + 3; |
| + Node** buffer = zone()->NewArray<Node*>(input_count); |
| + int index = 0; |
| + buffer[index++] = function; |
| + for (int i = 0; i < param_count; i++) { |
| + buffer[index++] = args[i]; |
| + } |
| + buffer[index++] = graph()->start(); |
| + buffer[index++] = graph()->start(); |
| + Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer); |
| + schedule()->AddTailCall(CurrentBlock(), tail_call); |
| + current_block_ = nullptr; |
| + return tail_call; |
| +} |
| + |
| + |
| +Node* RawMachineAssembler::TailCallRuntime1(Runtime::FunctionId function, |
| + Node* arg1, Node* context) { |
| + const int kArity = 1; |
| + CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor( |
| + zone(), function, kArity, Operator::kNoProperties, |
| + CallDescriptor::kSupportsTailCalls); |
| + |
| + Node* centry = HeapConstant(CEntryStub(isolate(), kArity).GetCode()); |
| + Node* ref = AddNode( |
| + common()->ExternalConstant(ExternalReference(function, isolate()))); |
| + Node* arity = Int32Constant(kArity); |
| + |
| + Node* nodes[] = {centry, arg1, ref, arity, context, graph()->start(), |
| + graph()->start()}; |
| + Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes); |
| + |
| + schedule()->AddTailCall(CurrentBlock(), tail_call); |
| + current_block_ = nullptr; |
| + return tail_call; |
| +} |
| + |
| + |
| +Node* RawMachineAssembler::TailCallRuntime2(Runtime::FunctionId function, |
| + Node* arg1, Node* arg2, |
| + Node* context) { |
| + const int kArity = 2; |
| + CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor( |
| + zone(), function, kArity, Operator::kNoProperties, |
| + CallDescriptor::kSupportsTailCalls); |
| + |
| + Node* centry = HeapConstant(CEntryStub(isolate(), kArity).GetCode()); |
| + Node* ref = AddNode( |
| + common()->ExternalConstant(ExternalReference(function, isolate()))); |
| + Node* arity = Int32Constant(kArity); |
| + |
| + Node* nodes[] = { |
| + centry, arg1, arg2, ref, arity, context, graph()->start(), |
| + graph()->start()}; |
| + 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); |