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 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 } | 1528 } |
1529 | 1529 |
1530 | 1530 |
1531 void InstructionSelector::EmitPrepareArguments(NodeVector* arguments, | 1531 void InstructionSelector::EmitPrepareArguments(NodeVector* arguments, |
1532 const CallDescriptor* descriptor, | 1532 const CallDescriptor* descriptor, |
1533 Node* node) { | 1533 Node* node) { |
1534 Arm64OperandGenerator g(this); | 1534 Arm64OperandGenerator g(this); |
1535 | 1535 |
1536 // Push the arguments to the stack. | 1536 // Push the arguments to the stack. |
1537 int aligned_push_count = static_cast<int>(arguments->size()); | 1537 int aligned_push_count = static_cast<int>(arguments->size()); |
| 1538 |
1538 bool pushed_count_uneven = aligned_push_count & 1; | 1539 bool pushed_count_uneven = aligned_push_count & 1; |
| 1540 int claim_count = aligned_push_count; |
| 1541 if (pushed_count_uneven && descriptor->UseNativeStack()) { |
| 1542 // We can only claim for an even number of call arguments when we use the |
| 1543 // native stack. |
| 1544 claim_count++; |
| 1545 } |
1539 // TODO(dcarney): claim and poke probably take small immediates, | 1546 // TODO(dcarney): claim and poke probably take small immediates, |
1540 // loop here or whatever. | 1547 // loop here or whatever. |
1541 // Bump the stack pointer(s). | 1548 // Bump the stack pointer(s). |
1542 if (aligned_push_count > 0) { | 1549 if (aligned_push_count > 0) { |
1543 // TODO(dcarney): it would be better to bump the csp here only | 1550 // TODO(dcarney): it would be better to bump the csp here only |
1544 // and emit paired stores with increment for non c frames. | 1551 // and emit paired stores with increment for non c frames. |
1545 Emit(kArm64ClaimForCallArguments, g.NoOutput(), | 1552 Emit(kArm64ClaimForCallArguments, g.NoOutput(), |
1546 g.TempImmediate(aligned_push_count)); | 1553 g.TempImmediate(claim_count)); |
1547 } | 1554 } |
| 1555 |
1548 // Move arguments to the stack. | 1556 // Move arguments to the stack. |
1549 { | 1557 int slot = aligned_push_count - 1; |
1550 int slot = aligned_push_count - 1; | 1558 while (slot >= 0) { |
1551 // Emit the uneven pushes. | 1559 Emit(kArm64Poke, g.NoOutput(), g.UseRegister((*arguments)[slot]), |
1552 if (pushed_count_uneven) { | 1560 g.TempImmediate(slot)); |
1553 Node* input = (*arguments)[slot]; | 1561 slot--; |
1554 Emit(kArm64Poke, g.NoOutput(), g.UseRegister(input), | 1562 // TODO(ahaas): Poke arguments in pairs if two subsequent arguments have the |
1555 g.TempImmediate(slot)); | 1563 // same type. |
1556 slot--; | 1564 // Emit(kArm64PokePair, g.NoOutput(), g.UseRegister((*arguments)[slot]), |
1557 } | 1565 // g.UseRegister((*arguments)[slot - 1]), g.TempImmediate(slot)); |
1558 // Now all pushes can be done in pairs. | 1566 // slot -= 2; |
1559 for (; slot >= 0; slot -= 2) { | |
1560 Emit(kArm64PokePair, g.NoOutput(), g.UseRegister((*arguments)[slot]), | |
1561 g.UseRegister((*arguments)[slot - 1]), g.TempImmediate(slot)); | |
1562 } | |
1563 } | 1567 } |
1564 } | 1568 } |
1565 | 1569 |
1566 | 1570 |
1567 bool InstructionSelector::IsTailCallAddressImmediate() { return false; } | 1571 bool InstructionSelector::IsTailCallAddressImmediate() { return false; } |
1568 | 1572 |
1569 | 1573 |
1570 namespace { | 1574 namespace { |
1571 | 1575 |
1572 // Shared routine for multiple compare operations. | 1576 // Shared routine for multiple compare operations. |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 MachineOperatorBuilder::kFloat32RoundTiesEven | | 2110 MachineOperatorBuilder::kFloat32RoundTiesEven | |
2107 MachineOperatorBuilder::kFloat64RoundTiesEven | | 2111 MachineOperatorBuilder::kFloat64RoundTiesEven | |
2108 MachineOperatorBuilder::kWord32ShiftIsSafe | | 2112 MachineOperatorBuilder::kWord32ShiftIsSafe | |
2109 MachineOperatorBuilder::kInt32DivIsSafe | | 2113 MachineOperatorBuilder::kInt32DivIsSafe | |
2110 MachineOperatorBuilder::kUint32DivIsSafe; | 2114 MachineOperatorBuilder::kUint32DivIsSafe; |
2111 } | 2115 } |
2112 | 2116 |
2113 } // namespace compiler | 2117 } // namespace compiler |
2114 } // namespace internal | 2118 } // namespace internal |
2115 } // namespace v8 | 2119 } // namespace v8 |
OLD | NEW |