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/arm/macro-assembler-arm.h" | 7 #include "src/arm/macro-assembler-arm.h" |
8 #include "src/assembler-inl.h" | 8 #include "src/assembler-inl.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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } while (0) | 415 } while (0) |
416 | 416 |
417 #define ASSEMBLE_ATOMIC_STORE_INTEGER(asm_instr) \ | 417 #define ASSEMBLE_ATOMIC_STORE_INTEGER(asm_instr) \ |
418 do { \ | 418 do { \ |
419 __ dmb(ISH); \ | 419 __ dmb(ISH); \ |
420 __ asm_instr(i.InputRegister(2), \ | 420 __ asm_instr(i.InputRegister(2), \ |
421 MemOperand(i.InputRegister(0), i.InputRegister(1))); \ | 421 MemOperand(i.InputRegister(0), i.InputRegister(1))); \ |
422 __ dmb(ISH); \ | 422 __ dmb(ISH); \ |
423 } while (0) | 423 } while (0) |
424 | 424 |
| 425 #define ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(load_instr, store_instr) \ |
| 426 do { \ |
| 427 Label exchange; \ |
| 428 __ dmb(ISH); \ |
| 429 __ bind(&exchange); \ |
| 430 __ add(i.TempRegister(0), i.InputRegister(0), i.InputRegister(1)); \ |
| 431 __ load_instr(i.OutputRegister(0), i.TempRegister(0)); \ |
| 432 __ store_instr(i.TempRegister(0), i.InputRegister(2), i.TempRegister(0)); \ |
| 433 __ teq(i.TempRegister(0), Operand(0)); \ |
| 434 __ b(ne, &exchange); \ |
| 435 __ dmb(ISH); \ |
| 436 } while (0) |
| 437 |
425 #define ASSEMBLE_IEEE754_BINOP(name) \ | 438 #define ASSEMBLE_IEEE754_BINOP(name) \ |
426 do { \ | 439 do { \ |
427 /* TODO(bmeurer): We should really get rid of this special instruction, */ \ | 440 /* TODO(bmeurer): We should really get rid of this special instruction, */ \ |
428 /* and generate a CallAddress instruction instead. */ \ | 441 /* and generate a CallAddress instruction instead. */ \ |
429 FrameScope scope(masm(), StackFrame::MANUAL); \ | 442 FrameScope scope(masm(), StackFrame::MANUAL); \ |
430 __ PrepareCallCFunction(0, 2, kScratchReg); \ | 443 __ PrepareCallCFunction(0, 2, kScratchReg); \ |
431 __ MovToFloatParameters(i.InputDoubleRegister(0), \ | 444 __ MovToFloatParameters(i.InputDoubleRegister(0), \ |
432 i.InputDoubleRegister(1)); \ | 445 i.InputDoubleRegister(1)); \ |
433 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \ | 446 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \ |
434 0, 2); \ | 447 0, 2); \ |
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 | 2015 |
2003 case kAtomicStoreWord8: | 2016 case kAtomicStoreWord8: |
2004 ASSEMBLE_ATOMIC_STORE_INTEGER(strb); | 2017 ASSEMBLE_ATOMIC_STORE_INTEGER(strb); |
2005 break; | 2018 break; |
2006 case kAtomicStoreWord16: | 2019 case kAtomicStoreWord16: |
2007 ASSEMBLE_ATOMIC_STORE_INTEGER(strh); | 2020 ASSEMBLE_ATOMIC_STORE_INTEGER(strh); |
2008 break; | 2021 break; |
2009 case kAtomicStoreWord32: | 2022 case kAtomicStoreWord32: |
2010 ASSEMBLE_ATOMIC_STORE_INTEGER(str); | 2023 ASSEMBLE_ATOMIC_STORE_INTEGER(str); |
2011 break; | 2024 break; |
| 2025 case kAtomicExchangeInt8: |
| 2026 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldrexb, strexb); |
| 2027 __ sxtb(i.OutputRegister(0), i.OutputRegister(0)); |
| 2028 break; |
| 2029 case kAtomicExchangeUint8: |
| 2030 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldrexb, strexb); |
| 2031 __ uxtb(i.OutputRegister(0), i.OutputRegister(0)); |
| 2032 break; |
| 2033 case kAtomicExchangeInt16: |
| 2034 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldrexh, strexh); |
| 2035 __ sxth(i.OutputRegister(0), i.OutputRegister(0)); |
| 2036 break; |
| 2037 case kAtomicExchangeUint16: |
| 2038 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldrexh, strexh); |
| 2039 __ uxth(i.OutputRegister(0), i.OutputRegister(0)); |
| 2040 break; |
| 2041 case kAtomicExchangeWord32: |
| 2042 ASSEMBLE_ATOMIC_EXCHANGE_INTEGER(ldrex, strex); |
| 2043 break; |
2012 } | 2044 } |
2013 return kSuccess; | 2045 return kSuccess; |
2014 } // NOLINT(readability/fn_size) | 2046 } // NOLINT(readability/fn_size) |
2015 | 2047 |
2016 | 2048 |
2017 // Assembles branches after an instruction. | 2049 // Assembles branches after an instruction. |
2018 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { | 2050 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { |
2019 ArmOperandConverter i(this, instr); | 2051 ArmOperandConverter i(this, instr); |
2020 Label* tlabel = branch->true_label; | 2052 Label* tlabel = branch->true_label; |
2021 Label* flabel = branch->false_label; | 2053 Label* flabel = branch->false_label; |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2606 padding_size -= v8::internal::Assembler::kInstrSize; | 2638 padding_size -= v8::internal::Assembler::kInstrSize; |
2607 } | 2639 } |
2608 } | 2640 } |
2609 } | 2641 } |
2610 | 2642 |
2611 #undef __ | 2643 #undef __ |
2612 | 2644 |
2613 } // namespace compiler | 2645 } // namespace compiler |
2614 } // namespace internal | 2646 } // namespace internal |
2615 } // namespace v8 | 2647 } // namespace v8 |
OLD | NEW |