Index: src/compiler/mips64/instruction-selector-mips64.cc |
diff --git a/src/compiler/mips64/instruction-selector-mips64.cc b/src/compiler/mips64/instruction-selector-mips64.cc |
index 4040337e0ce423cea62f10502d96575b9b92b48c..48185a676ffb495c5104f86ff9998be100b74046 100644 |
--- a/src/compiler/mips64/instruction-selector-mips64.cc |
+++ b/src/compiler/mips64/instruction-selector-mips64.cc |
@@ -673,18 +673,33 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
// Compute InstructionOperands for inputs and outputs. |
- InitializeCallBuffer(node, &buffer, true, false); |
+ InitializeCallBuffer(node, &buffer, true, true); |
- const int32_t push_count = static_cast<int32_t>(buffer.pushed_nodes.size()); |
- if (push_count > 0) { |
- Emit(kMips64StackClaim, g.NoOutput(), |
- g.TempImmediate(push_count << kPointerSizeLog2)); |
- } |
- int32_t slot = push_count - 1; |
- for (Node* node : base::Reversed(buffer.pushed_nodes)) { |
- Emit(kMips64StoreToStackSlot, g.NoOutput(), g.UseRegister(node), |
- g.TempImmediate(slot << kPointerSizeLog2)); |
- slot--; |
+ // Prepare for C function call. |
+ if (descriptor->IsCFunctionCall()) { |
+ Emit(kArchPrepareCallCFunction | |
+ MiscField::encode(static_cast<int>(descriptor->CParameterCount())), |
+ 0, nullptr, 0, nullptr); |
+ |
+ // Poke any stack arguments. |
+ int slot = kCArgSlotCount; |
+ for (Node* node : buffer.pushed_nodes) { |
+ Emit(kMips64StoreToStackSlot, g.NoOutput(), g.UseRegister(node), |
+ g.TempImmediate(slot << kPointerSizeLog2)); |
+ ++slot; |
+ } |
+ } else { |
+ const int32_t push_count = static_cast<int32_t>(buffer.pushed_nodes.size()); |
+ if (push_count > 0) { |
+ Emit(kMips64StackClaim, g.NoOutput(), |
+ g.TempImmediate(push_count << kPointerSizeLog2)); |
+ } |
+ int32_t slot = push_count - 1; |
+ for (Node* node : base::Reversed(buffer.pushed_nodes)) { |
+ Emit(kMips64StoreToStackSlot, g.NoOutput(), g.UseRegister(node), |
+ g.TempImmediate(slot << kPointerSizeLog2)); |
+ slot--; |
+ } |
} |
// Pass label of exception handler block. |
@@ -702,12 +717,16 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
// Select the appropriate opcode based on the call type. |
InstructionCode opcode; |
switch (descriptor->kind()) { |
- case CallDescriptor::kCallCodeObject: { |
- opcode = kArchCallCodeObject; |
+ case CallDescriptor::kCallAddress: |
+ opcode = |
+ kArchCallCFunction | |
+ MiscField::encode(static_cast<int>(descriptor->CParameterCount())); |
+ break; |
+ case CallDescriptor::kCallCodeObject: |
+ opcode = kArchCallCodeObject | MiscField::encode(flags); |
break; |
- } |
case CallDescriptor::kCallJSFunction: |
- opcode = kArchCallJSFunction; |
+ opcode = kArchCallJSFunction | MiscField::encode(flags); |
break; |
default: |
UNREACHABLE(); |