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/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/arm64/macro-assembler-arm64.h" | 8 #include "src/arm64/macro-assembler-arm64.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 Operand InputOperand64(size_t index) { return InputOperand(index); } | 92 Operand InputOperand64(size_t index) { return InputOperand(index); } |
93 | 93 |
94 Operand InputOperand32(size_t index) { | 94 Operand InputOperand32(size_t index) { |
95 return ToOperand32(instr_->InputAt(index)); | 95 return ToOperand32(instr_->InputAt(index)); |
96 } | 96 } |
97 | 97 |
98 Register OutputRegister64() { return OutputRegister(); } | 98 Register OutputRegister64() { return OutputRegister(); } |
99 | 99 |
100 Register OutputRegister32() { return ToRegister(instr_->Output()).W(); } | 100 Register OutputRegister32() { return ToRegister(instr_->Output()).W(); } |
101 | 101 |
| 102 Register TempRegister32() { return ToRegister(instr_->TempAt(0)).W(); } |
| 103 |
102 Operand InputOperand2_32(size_t index) { | 104 Operand InputOperand2_32(size_t index) { |
103 switch (AddressingModeField::decode(instr_->opcode())) { | 105 switch (AddressingModeField::decode(instr_->opcode())) { |
104 case kMode_None: | 106 case kMode_None: |
105 return InputOperand32(index); | 107 return InputOperand32(index); |
106 case kMode_Operand2_R_LSL_I: | 108 case kMode_Operand2_R_LSL_I: |
107 return Operand(InputRegister32(index), LSL, InputInt5(index + 1)); | 109 return Operand(InputRegister32(index), LSL, InputInt5(index + 1)); |
108 case kMode_Operand2_R_LSR_I: | 110 case kMode_Operand2_R_LSR_I: |
109 return Operand(InputRegister32(index), LSR, InputInt5(index + 1)); | 111 return Operand(InputRegister32(index), LSR, InputInt5(index + 1)); |
110 case kMode_Operand2_R_ASR_I: | 112 case kMode_Operand2_R_ASR_I: |
111 return Operand(InputRegister32(index), ASR, InputInt5(index + 1)); | 113 return Operand(InputRegister32(index), ASR, InputInt5(index + 1)); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 } while (0) | 522 } while (0) |
521 | 523 |
522 #define ASSEMBLE_ATOMIC_STORE_INTEGER(asm_instr) \ | 524 #define ASSEMBLE_ATOMIC_STORE_INTEGER(asm_instr) \ |
523 do { \ | 525 do { \ |
524 __ Dmb(InnerShareable, BarrierAll); \ | 526 __ Dmb(InnerShareable, BarrierAll); \ |
525 __ asm_instr(i.InputRegister(2), \ | 527 __ asm_instr(i.InputRegister(2), \ |
526 MemOperand(i.InputRegister(0), i.InputRegister(1))); \ | 528 MemOperand(i.InputRegister(0), i.InputRegister(1))); \ |
527 __ Dmb(InnerShareable, BarrierAll); \ | 529 __ Dmb(InnerShareable, BarrierAll); \ |
528 } while (0) | 530 } while (0) |
529 | 531 |
| 532 #define ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(load_instr, store_instr) \ |
| 533 do { \ |
| 534 Label exchange; \ |
| 535 __ bind(&exchange); \ |
| 536 __ Add(i.TempRegister(0), i.InputRegister(0), i.InputRegister(1)); \ |
| 537 __ load_instr(i.OutputRegister32(), i.TempRegister(0)); \ |
| 538 __ store_instr(i.TempRegister32(), i.InputRegister32(2), \ |
| 539 i.TempRegister(0)); \ |
| 540 __ cbnz(i.TempRegister32(), &exchange); \ |
| 541 } while (0) |
| 542 |
530 #define ASSEMBLE_IEEE754_BINOP(name) \ | 543 #define ASSEMBLE_IEEE754_BINOP(name) \ |
531 do { \ | 544 do { \ |
532 FrameScope scope(masm(), StackFrame::MANUAL); \ | 545 FrameScope scope(masm(), StackFrame::MANUAL); \ |
533 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \ | 546 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \ |
534 0, 2); \ | 547 0, 2); \ |
535 } while (0) | 548 } while (0) |
536 | 549 |
537 #define ASSEMBLE_IEEE754_UNOP(name) \ | 550 #define ASSEMBLE_IEEE754_UNOP(name) \ |
538 do { \ | 551 do { \ |
539 FrameScope scope(masm(), StackFrame::MANUAL); \ | 552 FrameScope scope(masm(), StackFrame::MANUAL); \ |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 break; | 1637 break; |
1625 case kAtomicStoreWord16: | 1638 case kAtomicStoreWord16: |
1626 ASSEMBLE_ATOMIC_STORE_INTEGER(Strh); | 1639 ASSEMBLE_ATOMIC_STORE_INTEGER(Strh); |
1627 break; | 1640 break; |
1628 case kAtomicStoreWord32: | 1641 case kAtomicStoreWord32: |
1629 __ Dmb(InnerShareable, BarrierAll); | 1642 __ Dmb(InnerShareable, BarrierAll); |
1630 __ Str(i.InputRegister32(2), | 1643 __ Str(i.InputRegister32(2), |
1631 MemOperand(i.InputRegister(0), i.InputRegister(1))); | 1644 MemOperand(i.InputRegister(0), i.InputRegister(1))); |
1632 __ Dmb(InnerShareable, BarrierAll); | 1645 __ Dmb(InnerShareable, BarrierAll); |
1633 break; | 1646 break; |
| 1647 case kAtomicExchangeInt8: |
| 1648 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrb, stlxrb); |
| 1649 __ Sxtb(i.OutputRegister(0), i.OutputRegister(0)); |
| 1650 break; |
| 1651 case kAtomicExchangeUint8: |
| 1652 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrb, stlxrb); |
| 1653 __ Uxtb(i.OutputRegister(0), i.OutputRegister(0)); |
| 1654 break; |
| 1655 case kAtomicExchangeInt16: |
| 1656 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrh, stlxrh); |
| 1657 __ Sxth(i.OutputRegister(0), i.OutputRegister(0)); |
| 1658 break; |
| 1659 case kAtomicExchangeUint16: |
| 1660 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrh, stlxrh); |
| 1661 __ Uxth(i.OutputRegister(0), i.OutputRegister(0)); |
| 1662 break; |
| 1663 case kAtomicExchangeWord32: |
| 1664 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxr, stlxr); |
| 1665 break; |
1634 } | 1666 } |
1635 return kSuccess; | 1667 return kSuccess; |
1636 } // NOLINT(readability/fn_size) | 1668 } // NOLINT(readability/fn_size) |
1637 | 1669 |
1638 | 1670 |
1639 // Assemble branches after this instruction. | 1671 // Assemble branches after this instruction. |
1640 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { | 1672 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { |
1641 Arm64OperandConverter i(this, instr); | 1673 Arm64OperandConverter i(this, instr); |
1642 Label* tlabel = branch->true_label; | 1674 Label* tlabel = branch->true_label; |
1643 Label* flabel = branch->false_label; | 1675 Label* flabel = branch->false_label; |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2177 padding_size -= kInstructionSize; | 2209 padding_size -= kInstructionSize; |
2178 } | 2210 } |
2179 } | 2211 } |
2180 } | 2212 } |
2181 | 2213 |
2182 #undef __ | 2214 #undef __ |
2183 | 2215 |
2184 } // namespace compiler | 2216 } // namespace compiler |
2185 } // namespace internal | 2217 } // namespace internal |
2186 } // namespace v8 | 2218 } // namespace v8 |
OLD | NEW |