OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/instruction-selector.h" | 5 #include "src/compiler/instruction-selector.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/base/adapters.h" | 9 #include "src/base/adapters.h" |
10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 if (handler) { | 1536 if (handler) { |
1537 DCHECK_EQ(IrOpcode::kIfException, handler->front()->opcode()); | 1537 DCHECK_EQ(IrOpcode::kIfException, handler->front()->opcode()); |
1538 IfExceptionHint hint = OpParameter<IfExceptionHint>(handler->front()); | 1538 IfExceptionHint hint = OpParameter<IfExceptionHint>(handler->front()); |
1539 if (hint == IfExceptionHint::kLocallyCaught) { | 1539 if (hint == IfExceptionHint::kLocallyCaught) { |
1540 flags |= CallDescriptor::kHasLocalCatchHandler; | 1540 flags |= CallDescriptor::kHasLocalCatchHandler; |
1541 } | 1541 } |
1542 flags |= CallDescriptor::kHasExceptionHandler; | 1542 flags |= CallDescriptor::kHasExceptionHandler; |
1543 buffer.instruction_args.push_back(g.Label(handler)); | 1543 buffer.instruction_args.push_back(g.Label(handler)); |
1544 } | 1544 } |
1545 | 1545 |
1546 // (arm64 only) caller uses JSSP but callee might destroy it. | 1546 bool from_native_stack = linkage()->GetIncomingDescriptor()->UseNativeStack(); |
1547 if (descriptor->UseNativeStack() && | 1547 bool to_native_stack = descriptor->UseNativeStack(); |
1548 !linkage()->GetIncomingDescriptor()->UseNativeStack()) { | 1548 if (from_native_stack != to_native_stack) { |
1549 flags |= CallDescriptor::kRestoreJSSP; | 1549 // (arm64 only) Mismatch in the use of stack pointers. One or the other |
| 1550 // has to be restored manually by the code generator. |
| 1551 flags |= to_native_stack ? CallDescriptor::kRestoreJSSP |
| 1552 : CallDescriptor::kRestoreCSP; |
1550 } | 1553 } |
1551 | 1554 |
1552 | |
1553 // Select the appropriate opcode based on the call type. | 1555 // Select the appropriate opcode based on the call type. |
1554 InstructionCode opcode = kArchNop; | 1556 InstructionCode opcode = kArchNop; |
1555 switch (descriptor->kind()) { | 1557 switch (descriptor->kind()) { |
1556 case CallDescriptor::kCallAddress: | 1558 case CallDescriptor::kCallAddress: |
1557 opcode = | 1559 opcode = |
1558 kArchCallCFunction | | 1560 kArchCallCFunction | |
1559 MiscField::encode(static_cast<int>(descriptor->CParameterCount())); | 1561 MiscField::encode(static_cast<int>(descriptor->CParameterCount())); |
1560 break; | 1562 break; |
1561 case CallDescriptor::kCallCodeObject: | 1563 case CallDescriptor::kCallCodeObject: |
1562 opcode = kArchCallCodeObject | MiscField::encode(flags); | 1564 opcode = kArchCallCodeObject | MiscField::encode(flags); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 return new (instruction_zone()) FrameStateDescriptor( | 1787 return new (instruction_zone()) FrameStateDescriptor( |
1786 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1788 instruction_zone(), state_info.type(), state_info.bailout_id(), |
1787 state_info.state_combine(), parameters, locals, stack, | 1789 state_info.state_combine(), parameters, locals, stack, |
1788 state_info.shared_info(), outer_state); | 1790 state_info.shared_info(), outer_state); |
1789 } | 1791 } |
1790 | 1792 |
1791 | 1793 |
1792 } // namespace compiler | 1794 } // namespace compiler |
1793 } // namespace internal | 1795 } // namespace internal |
1794 } // namespace v8 | 1796 } // namespace v8 |
OLD | NEW |