Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: src/compiler/arm64/code-generator-arm64.cc

Issue 2754543006: [arm64] Use exclusive instructions in exchange (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 do { \ 527 do { \
528 __ Dmb(InnerShareable, BarrierAll); \ 528 __ Dmb(InnerShareable, BarrierAll); \
529 __ asm_instr(i.InputRegister(2), \ 529 __ asm_instr(i.InputRegister(2), \
530 MemOperand(i.InputRegister(0), i.InputRegister(1))); \ 530 MemOperand(i.InputRegister(0), i.InputRegister(1))); \
531 __ Dmb(InnerShareable, BarrierAll); \ 531 __ Dmb(InnerShareable, BarrierAll); \
532 } while (0) 532 } while (0)
533 533
534 #define ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(load_instr, store_instr) \ 534 #define ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(load_instr, store_instr) \
535 do { \ 535 do { \
536 Label exchange; \ 536 Label exchange; \
537 __ bind(&exchange); \ 537 __ Dmb(InnerShareable, BarrierAll); \
538 __ Bind(&exchange); \
538 __ Add(i.TempRegister(0), i.InputRegister(0), i.InputRegister(1)); \ 539 __ Add(i.TempRegister(0), i.InputRegister(0), i.InputRegister(1)); \
539 __ load_instr(i.OutputRegister32(), i.TempRegister(0)); \ 540 __ load_instr(i.OutputRegister32(), i.TempRegister(0)); \
540 __ store_instr(i.TempRegister32(), i.InputRegister32(2), \ 541 __ store_instr(i.TempRegister32(), i.InputRegister32(2), \
541 i.TempRegister(0)); \ 542 i.TempRegister(0)); \
542 __ cbnz(i.TempRegister32(), &exchange); \ 543 __ Cbnz(i.TempRegister32(), &exchange); \
544 __ Dmb(InnerShareable, BarrierAll); \
543 } while (0) 545 } while (0)
544 546
545 #define ASSEMBLE_IEEE754_BINOP(name) \ 547 #define ASSEMBLE_IEEE754_BINOP(name) \
546 do { \ 548 do { \
547 FrameScope scope(masm(), StackFrame::MANUAL); \ 549 FrameScope scope(masm(), StackFrame::MANUAL); \
548 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \ 550 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \
549 0, 2); \ 551 0, 2); \
550 } while (0) 552 } while (0)
551 553
552 #define ASSEMBLE_IEEE754_UNOP(name) \ 554 #define ASSEMBLE_IEEE754_UNOP(name) \
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 case kAtomicStoreWord16: 1642 case kAtomicStoreWord16:
1641 ASSEMBLE_ATOMIC_STORE_INTEGER(Strh); 1643 ASSEMBLE_ATOMIC_STORE_INTEGER(Strh);
1642 break; 1644 break;
1643 case kAtomicStoreWord32: 1645 case kAtomicStoreWord32:
1644 __ Dmb(InnerShareable, BarrierAll); 1646 __ Dmb(InnerShareable, BarrierAll);
1645 __ Str(i.InputRegister32(2), 1647 __ Str(i.InputRegister32(2),
1646 MemOperand(i.InputRegister(0), i.InputRegister(1))); 1648 MemOperand(i.InputRegister(0), i.InputRegister(1)));
1647 __ Dmb(InnerShareable, BarrierAll); 1649 __ Dmb(InnerShareable, BarrierAll);
1648 break; 1650 break;
1649 case kAtomicExchangeInt8: 1651 case kAtomicExchangeInt8:
1650 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrb, stlxrb); 1652 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldxrb, stxrb);
1651 __ Sxtb(i.OutputRegister(0), i.OutputRegister(0)); 1653 __ Sxtb(i.OutputRegister(0), i.OutputRegister(0));
1652 break; 1654 break;
1653 case kAtomicExchangeUint8: 1655 case kAtomicExchangeUint8:
1654 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrb, stlxrb); 1656 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldxrb, stxrb);
1655 break; 1657 break;
1656 case kAtomicExchangeInt16: 1658 case kAtomicExchangeInt16:
1657 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrh, stlxrh); 1659 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldxrh, stxrh);
1658 __ Sxth(i.OutputRegister(0), i.OutputRegister(0)); 1660 __ Sxth(i.OutputRegister(0), i.OutputRegister(0));
1659 break; 1661 break;
1660 case kAtomicExchangeUint16: 1662 case kAtomicExchangeUint16:
1661 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxrh, stlxrh); 1663 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldxrh, stxrh);
1662 break; 1664 break;
1663 case kAtomicExchangeWord32: 1665 case kAtomicExchangeWord32:
1664 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldaxr, stlxr); 1666 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldxr, stxr);
1665 break; 1667 break;
1666 } 1668 }
1667 return kSuccess; 1669 return kSuccess;
1668 } // NOLINT(readability/fn_size) 1670 } // NOLINT(readability/fn_size)
1669 1671
1670 1672
1671 // Assemble branches after this instruction. 1673 // Assemble branches after this instruction.
1672 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { 1674 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
1673 Arm64OperandConverter i(this, instr); 1675 Arm64OperandConverter i(this, instr);
1674 Label* tlabel = branch->true_label; 1676 Label* tlabel = branch->true_label;
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 padding_size -= kInstructionSize; 2211 padding_size -= kInstructionSize;
2210 } 2212 }
2211 } 2213 }
2212 } 2214 }
2213 2215
2214 #undef __ 2216 #undef __
2215 2217
2216 } // namespace compiler 2218 } // namespace compiler
2217 } // namespace internal 2219 } // namespace internal
2218 } // namespace v8 2220 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698