Chromium Code Reviews| 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/assembler-arm64-inl.h" | 7 #include "src/arm64/assembler-arm64-inl.h" |
| 8 #include "src/arm64/frames-arm64.h" | 8 #include "src/arm64/frames-arm64.h" |
| 9 #include "src/arm64/macro-assembler-arm64-inl.h" | 9 #include "src/arm64/macro-assembler-arm64-inl.h" |
| 10 #include "src/compilation-info.h" | 10 #include "src/compilation-info.h" |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 511 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), \ | 511 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), \ |
| 512 i.InputRegister##width(1)); \ | 512 i.InputRegister##width(1)); \ |
| 513 } else { \ | 513 } else { \ |
| 514 uint32_t imm = \ | 514 uint32_t imm = \ |
| 515 static_cast<uint32_t>(i.InputOperand##width(1).ImmediateValue()); \ | 515 static_cast<uint32_t>(i.InputOperand##width(1).ImmediateValue()); \ |
| 516 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), \ | 516 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), \ |
| 517 imm % (width)); \ | 517 imm % (width)); \ |
| 518 } \ | 518 } \ |
| 519 } while (0) | 519 } while (0) |
| 520 | 520 |
| 521 #define ASSEMBLE_ATOMIC_LOAD_INTEGER(asm_instr) \ | 521 #define ASSEMBLE_ATOMIC_LOAD_INTEGER(asm_instr) \ |
| 522 do { \ | 522 do { \ |
| 523 __ asm_instr(i.OutputRegister(), \ | 523 __ Add(i.TempRegister(0), i.InputRegister(0), i.InputRegister(1)); \ |
| 524 MemOperand(i.InputRegister(0), i.InputRegister(1))); \ | 524 __ asm_instr(i.OutputRegister32(), i.TempRegister(0)); \ |
| 525 __ Dmb(InnerShareable, BarrierAll); \ | |
| 526 } while (0) | 525 } while (0) |
| 527 | 526 |
| 528 #define ASSEMBLE_ATOMIC_STORE_INTEGER(asm_instr) \ | 527 #define ASSEMBLE_ATOMIC_STORE_INTEGER(asm_instr) \ |
| 529 do { \ | 528 do { \ |
| 530 __ Dmb(InnerShareable, BarrierAll); \ | 529 __ Add(i.TempRegister(0), i.InputRegister(0), i.InputRegister(1)); \ |
| 531 __ asm_instr(i.InputRegister(2), \ | 530 __ asm_instr(i.InputRegister32(2), i.TempRegister(0)); \ |
| 532 MemOperand(i.InputRegister(0), i.InputRegister(1))); \ | |
| 533 __ Dmb(InnerShareable, BarrierAll); \ | |
| 534 } while (0) | 531 } while (0) |
| 535 | 532 |
| 536 #define ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(load_instr, store_instr) \ | 533 #define ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(load_instr, store_instr) \ |
| 537 do { \ | 534 do { \ |
| 538 Label exchange; \ | 535 Label exchange; \ |
| 539 __ bind(&exchange); \ | 536 __ bind(&exchange); \ |
| 540 __ Add(i.TempRegister(0), i.InputRegister(0), i.InputRegister(1)); \ | 537 __ Add(i.TempRegister(0), i.InputRegister(0), i.InputRegister(1)); \ |
| 541 __ load_instr(i.OutputRegister32(), i.TempRegister(0)); \ | 538 __ load_instr(i.OutputRegister32(), i.TempRegister(0)); \ |
| 542 __ store_instr(i.TempRegister32(0), i.InputRegister32(2), \ | 539 __ store_instr(i.TempRegister32(0), i.InputRegister32(2), \ |
| 543 i.TempRegister(0)); \ | 540 i.TempRegister(0)); \ |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1628 case kCheckedStoreWord64: | 1625 case kCheckedStoreWord64: |
| 1629 ASSEMBLE_CHECKED_STORE_INTEGER_64(Str); | 1626 ASSEMBLE_CHECKED_STORE_INTEGER_64(Str); |
| 1630 break; | 1627 break; |
| 1631 case kCheckedStoreFloat32: | 1628 case kCheckedStoreFloat32: |
| 1632 ASSEMBLE_CHECKED_STORE_FLOAT(32); | 1629 ASSEMBLE_CHECKED_STORE_FLOAT(32); |
| 1633 break; | 1630 break; |
| 1634 case kCheckedStoreFloat64: | 1631 case kCheckedStoreFloat64: |
| 1635 ASSEMBLE_CHECKED_STORE_FLOAT(64); | 1632 ASSEMBLE_CHECKED_STORE_FLOAT(64); |
| 1636 break; | 1633 break; |
| 1637 case kAtomicLoadInt8: | 1634 case kAtomicLoadInt8: |
| 1638 ASSEMBLE_ATOMIC_LOAD_INTEGER(Ldrsb); | 1635 ASSEMBLE_ATOMIC_LOAD_INTEGER(Ldarb); |
| 1636 __ Sxtb(i.OutputRegister(0), i.OutputRegister(0)); | |
| 1639 break; | 1637 break; |
| 1640 case kAtomicLoadUint8: | 1638 case kAtomicLoadUint8: |
| 1641 ASSEMBLE_ATOMIC_LOAD_INTEGER(Ldrb); | 1639 ASSEMBLE_ATOMIC_LOAD_INTEGER(Ldarb); |
| 1642 break; | 1640 break; |
| 1643 case kAtomicLoadInt16: | 1641 case kAtomicLoadInt16: |
| 1644 ASSEMBLE_ATOMIC_LOAD_INTEGER(Ldrsh); | 1642 ASSEMBLE_ATOMIC_LOAD_INTEGER(Ldarh); |
| 1643 __ Sxth(i.OutputRegister(0), i.OutputRegister(0)); | |
| 1645 break; | 1644 break; |
| 1646 case kAtomicLoadUint16: | 1645 case kAtomicLoadUint16: |
| 1647 ASSEMBLE_ATOMIC_LOAD_INTEGER(Ldrh); | 1646 ASSEMBLE_ATOMIC_LOAD_INTEGER(Ldarh); |
| 1648 break; | 1647 break; |
| 1649 case kAtomicLoadWord32: | 1648 case kAtomicLoadWord32: |
| 1650 __ Ldr(i.OutputRegister32(), | 1649 ASSEMBLE_ATOMIC_LOAD_INTEGER(Ldar); |
| 1651 MemOperand(i.InputRegister(0), i.InputRegister(1))); | |
| 1652 __ Dmb(InnerShareable, BarrierAll); | |
| 1653 break; | 1650 break; |
| 1654 case kAtomicStoreWord8: | 1651 case kAtomicStoreWord8: |
| 1655 ASSEMBLE_ATOMIC_STORE_INTEGER(Strb); | 1652 ASSEMBLE_ATOMIC_STORE_INTEGER(Stlrb); |
|
aseemgarg
2017/03/20 20:56:46
Is this correct? Since, stlr/b/h is store with rel
| |
| 1656 break; | 1653 break; |
| 1657 case kAtomicStoreWord16: | 1654 case kAtomicStoreWord16: |
| 1658 ASSEMBLE_ATOMIC_STORE_INTEGER(Strh); | 1655 ASSEMBLE_ATOMIC_STORE_INTEGER(Stlrh); |
| 1659 break; | 1656 break; |
| 1660 case kAtomicStoreWord32: | 1657 case kAtomicStoreWord32: |
| 1661 __ Dmb(InnerShareable, BarrierAll); | 1658 ASSEMBLE_ATOMIC_STORE_INTEGER(Stlr); |
| 1662 __ Str(i.InputRegister32(2), | |
| 1663 MemOperand(i.InputRegister(0), i.InputRegister(1))); | |
| 1664 __ Dmb(InnerShareable, BarrierAll); | |
| 1665 break; | 1659 break; |
| 1666 case kAtomicExchangeInt8: | 1660 case kAtomicExchangeInt8: |
| 1667 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrb, stlxrb); | 1661 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrb, stlxrb); |
| 1668 __ Sxtb(i.OutputRegister(0), i.OutputRegister(0)); | 1662 __ Sxtb(i.OutputRegister(0), i.OutputRegister(0)); |
| 1669 break; | 1663 break; |
| 1670 case kAtomicExchangeUint8: | 1664 case kAtomicExchangeUint8: |
| 1671 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrb, stlxrb); | 1665 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrb, stlxrb); |
| 1672 break; | 1666 break; |
| 1673 case kAtomicExchangeInt16: | 1667 case kAtomicExchangeInt16: |
| 1674 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrh, stlxrh); | 1668 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrh, stlxrh); |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2250 padding_size -= kInstructionSize; | 2244 padding_size -= kInstructionSize; |
| 2251 } | 2245 } |
| 2252 } | 2246 } |
| 2253 } | 2247 } |
| 2254 | 2248 |
| 2255 #undef __ | 2249 #undef __ |
| 2256 | 2250 |
| 2257 } // namespace compiler | 2251 } // namespace compiler |
| 2258 } // namespace internal | 2252 } // namespace internal |
| 2259 } // namespace v8 | 2253 } // namespace v8 |
| OLD | NEW |