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-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { | 1624 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { |
1625 VisitRR(this, kArm64Float64RoundTiesEven, node); | 1625 VisitRR(this, kArm64Float64RoundTiesEven, node); |
1626 } | 1626 } |
1627 | 1627 |
1628 | 1628 |
1629 void InstructionSelector::EmitPrepareArguments( | 1629 void InstructionSelector::EmitPrepareArguments( |
1630 ZoneVector<PushParameter>* arguments, const CallDescriptor* descriptor, | 1630 ZoneVector<PushParameter>* arguments, const CallDescriptor* descriptor, |
1631 Node* node) { | 1631 Node* node) { |
1632 Arm64OperandGenerator g(this); | 1632 Arm64OperandGenerator g(this); |
1633 | 1633 |
| 1634 bool from_native_stack = linkage()->GetIncomingDescriptor()->UseNativeStack(); |
1634 bool to_native_stack = descriptor->UseNativeStack(); | 1635 bool to_native_stack = descriptor->UseNativeStack(); |
1635 | 1636 |
| 1637 bool always_claim = to_native_stack != from_native_stack; |
| 1638 |
1636 int claim_count = static_cast<int>(arguments->size()); | 1639 int claim_count = static_cast<int>(arguments->size()); |
1637 int slot = claim_count - 1; | 1640 int slot = claim_count - 1; |
1638 if (to_native_stack) { | |
1639 // Native stack must always be aligned to 16 (2 words). | |
1640 claim_count = RoundUp(claim_count, 2); | |
1641 } | |
1642 // TODO(titzer): claim and poke probably take small immediates. | |
1643 // Bump the stack pointer(s). | 1641 // Bump the stack pointer(s). |
1644 if (claim_count > 0 || to_native_stack) { | 1642 if (claim_count > 0 || always_claim) { |
| 1643 // TODO(titzer): claim and poke probably take small immediates. |
1645 // TODO(titzer): it would be better to bump the csp here only | 1644 // TODO(titzer): it would be better to bump the csp here only |
1646 // and emit paired stores with increment for non c frames. | 1645 // and emit paired stores with increment for non c frames. |
1647 ArchOpcode claim = to_native_stack ? kArm64ClaimCSP : kArm64ClaimJSSP; | 1646 ArchOpcode claim = to_native_stack ? kArm64ClaimCSP : kArm64ClaimJSSP; |
| 1647 // Claim(0) isn't a nop if there is a mismatch between CSP and JSSP. |
1648 Emit(claim, g.NoOutput(), g.TempImmediate(claim_count)); | 1648 Emit(claim, g.NoOutput(), g.TempImmediate(claim_count)); |
1649 } | 1649 } |
1650 | 1650 |
1651 // Poke the arguments into the stack. | 1651 // Poke the arguments into the stack. |
1652 ArchOpcode poke = to_native_stack ? kArm64PokeCSP : kArm64PokeJSSP; | 1652 ArchOpcode poke = to_native_stack ? kArm64PokeCSP : kArm64PokeJSSP; |
1653 while (slot >= 0) { | 1653 while (slot >= 0) { |
1654 Emit(poke, g.NoOutput(), g.UseRegister((*arguments)[slot].node()), | 1654 Emit(poke, g.NoOutput(), g.UseRegister((*arguments)[slot].node()), |
1655 g.TempImmediate(slot)); | 1655 g.TempImmediate(slot)); |
1656 slot--; | 1656 slot--; |
1657 // TODO(ahaas): Poke arguments in pairs if two subsequent arguments have the | 1657 // TODO(ahaas): Poke arguments in pairs if two subsequent arguments have the |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 MachineOperatorBuilder::kWord32ShiftIsSafe | | 2263 MachineOperatorBuilder::kWord32ShiftIsSafe | |
2264 MachineOperatorBuilder::kInt32DivIsSafe | | 2264 MachineOperatorBuilder::kInt32DivIsSafe | |
2265 MachineOperatorBuilder::kUint32DivIsSafe | | 2265 MachineOperatorBuilder::kUint32DivIsSafe | |
2266 MachineOperatorBuilder::kWord32ReverseBits | | 2266 MachineOperatorBuilder::kWord32ReverseBits | |
2267 MachineOperatorBuilder::kWord64ReverseBits; | 2267 MachineOperatorBuilder::kWord64ReverseBits; |
2268 } | 2268 } |
2269 | 2269 |
2270 } // namespace compiler | 2270 } // namespace compiler |
2271 } // namespace internal | 2271 } // namespace internal |
2272 } // namespace v8 | 2272 } // namespace v8 |
OLD | NEW |