Index: src/compiler/instruction-selector.cc |
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc |
index 91900be25c30dabec502028de1401680631509ae..400dcd12d12267d13918d3df57da496230519e03 100644 |
--- a/src/compiler/instruction-selector.cc |
+++ b/src/compiler/instruction-selector.cc |
@@ -1543,13 +1543,15 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
buffer.instruction_args.push_back(g.Label(handler)); |
} |
- // (arm64 only) caller uses JSSP but callee might destroy it. |
- if (descriptor->UseNativeStack() && |
- !linkage()->GetIncomingDescriptor()->UseNativeStack()) { |
- flags |= CallDescriptor::kRestoreJSSP; |
+ bool from_native_stack = linkage()->GetIncomingDescriptor()->UseNativeStack(); |
+ bool to_native_stack = descriptor->UseNativeStack(); |
+ if (from_native_stack != to_native_stack) { |
+ // (arm64 only) Mismatch in the use of stack pointers. One or the other |
+ // has to be restored manually by the code generator. |
+ flags |= to_native_stack ? CallDescriptor::kRestoreJSSP |
+ : CallDescriptor::kRestoreCSP; |
} |
- |
// Select the appropriate opcode based on the call type. |
InstructionCode opcode = kArchNop; |
switch (descriptor->kind()) { |