| 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 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1586 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { | 1586 void InstructionSelector::VisitFloat64RoundTiesEven(Node* node) { |
| 1587 VisitRR(this, kArm64Float64RoundTiesEven, node); | 1587 VisitRR(this, kArm64Float64RoundTiesEven, node); |
| 1588 } | 1588 } |
| 1589 | 1589 |
| 1590 | 1590 |
| 1591 void InstructionSelector::EmitPrepareArguments( | 1591 void InstructionSelector::EmitPrepareArguments( |
| 1592 ZoneVector<PushParameter>* arguments, const CallDescriptor* descriptor, | 1592 ZoneVector<PushParameter>* arguments, const CallDescriptor* descriptor, |
| 1593 Node* node) { | 1593 Node* node) { |
| 1594 Arm64OperandGenerator g(this); | 1594 Arm64OperandGenerator g(this); |
| 1595 | 1595 |
| 1596 // Push the arguments to the stack. | 1596 bool to_native_stack = descriptor->UseNativeStack(); |
| 1597 int aligned_push_count = static_cast<int>(arguments->size()); | |
| 1598 | 1597 |
| 1599 bool pushed_count_uneven = aligned_push_count & 1; | 1598 int claim_count = static_cast<int>(arguments->size()); |
| 1600 int claim_count = aligned_push_count; | 1599 int slot = claim_count - 1; |
| 1601 if (pushed_count_uneven && descriptor->UseNativeStack()) { | 1600 if (to_native_stack) { |
| 1602 // We can only claim for an even number of call arguments when we use the | 1601 // Native stack must always be aligned to 16 (2 words). |
| 1603 // native stack. | 1602 claim_count = RoundUp(claim_count, 2); |
| 1604 claim_count++; | |
| 1605 } | 1603 } |
| 1606 // TODO(dcarney): claim and poke probably take small immediates, | 1604 // TODO(titzer): claim and poke probably take small immediates. |
| 1607 // loop here or whatever. | |
| 1608 // Bump the stack pointer(s). | 1605 // Bump the stack pointer(s). |
| 1609 if (aligned_push_count > 0) { | 1606 if (claim_count > 0) { |
| 1610 // TODO(dcarney): it would be better to bump the csp here only | 1607 // TODO(titzer): it would be better to bump the csp here only |
| 1611 // and emit paired stores with increment for non c frames. | 1608 // and emit paired stores with increment for non c frames. |
| 1612 Emit(kArm64ClaimForCallArguments, g.NoOutput(), | 1609 ArchOpcode claim = to_native_stack ? kArm64ClaimCSP : kArm64ClaimJSSP; |
| 1613 g.TempImmediate(claim_count)); | 1610 Emit(claim, g.NoOutput(), g.TempImmediate(claim_count)); |
| 1614 } | 1611 } |
| 1615 | 1612 |
| 1616 // Move arguments to the stack. | 1613 // Poke the arguments into the stack. |
| 1617 int slot = aligned_push_count - 1; | 1614 ArchOpcode poke = to_native_stack ? kArm64PokeCSP : kArm64PokeJSSP; |
| 1618 while (slot >= 0) { | 1615 while (slot >= 0) { |
| 1619 Emit(kArm64Poke, g.NoOutput(), g.UseRegister((*arguments)[slot].node()), | 1616 Emit(poke, g.NoOutput(), g.UseRegister((*arguments)[slot].node()), |
| 1620 g.TempImmediate(slot)); | 1617 g.TempImmediate(slot)); |
| 1621 slot--; | 1618 slot--; |
| 1622 // TODO(ahaas): Poke arguments in pairs if two subsequent arguments have the | 1619 // TODO(ahaas): Poke arguments in pairs if two subsequent arguments have the |
| 1623 // same type. | 1620 // same type. |
| 1624 // Emit(kArm64PokePair, g.NoOutput(), g.UseRegister((*arguments)[slot]), | 1621 // Emit(kArm64PokePair, g.NoOutput(), g.UseRegister((*arguments)[slot]), |
| 1625 // g.UseRegister((*arguments)[slot - 1]), g.TempImmediate(slot)); | 1622 // g.UseRegister((*arguments)[slot - 1]), g.TempImmediate(slot)); |
| 1626 // slot -= 2; | 1623 // slot -= 2; |
| 1627 } | 1624 } |
| 1628 } | 1625 } |
| 1629 | 1626 |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2200 MachineOperatorBuilder::kFloat32RoundTiesEven | | 2197 MachineOperatorBuilder::kFloat32RoundTiesEven | |
| 2201 MachineOperatorBuilder::kFloat64RoundTiesEven | | 2198 MachineOperatorBuilder::kFloat64RoundTiesEven | |
| 2202 MachineOperatorBuilder::kWord32ShiftIsSafe | | 2199 MachineOperatorBuilder::kWord32ShiftIsSafe | |
| 2203 MachineOperatorBuilder::kInt32DivIsSafe | | 2200 MachineOperatorBuilder::kInt32DivIsSafe | |
| 2204 MachineOperatorBuilder::kUint32DivIsSafe; | 2201 MachineOperatorBuilder::kUint32DivIsSafe; |
| 2205 } | 2202 } |
| 2206 | 2203 |
| 2207 } // namespace compiler | 2204 } // namespace compiler |
| 2208 } // namespace internal | 2205 } // namespace internal |
| 2209 } // namespace v8 | 2206 } // namespace v8 |
| OLD | NEW |