| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
| 8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } else { \ | 241 } else { \ |
| 242 if (instr->Output()->IsRegister()) { \ | 242 if (instr->Output()->IsRegister()) { \ |
| 243 __ asm_instr##_cl(i.OutputRegister()); \ | 243 __ asm_instr##_cl(i.OutputRegister()); \ |
| 244 } else { \ | 244 } else { \ |
| 245 __ asm_instr##_cl(i.OutputOperand()); \ | 245 __ asm_instr##_cl(i.OutputOperand()); \ |
| 246 } \ | 246 } \ |
| 247 } \ | 247 } \ |
| 248 } while (0) | 248 } while (0) |
| 249 | 249 |
| 250 | 250 |
| 251 #define ASSEMBLE_MOVX(asm_instr) \ |
| 252 do { \ |
| 253 if (instr->addressing_mode() != kMode_None) { \ |
| 254 __ asm_instr(i.OutputRegister(), i.MemoryOperand()); \ |
| 255 } else if (instr->InputAt(0)->IsRegister()) { \ |
| 256 __ asm_instr(i.OutputRegister(), i.InputRegister(0)); \ |
| 257 } else { \ |
| 258 __ asm_instr(i.OutputRegister(), i.InputOperand(0)); \ |
| 259 } \ |
| 260 } while (0) |
| 261 |
| 262 |
| 251 #define ASSEMBLE_DOUBLE_BINOP(asm_instr) \ | 263 #define ASSEMBLE_DOUBLE_BINOP(asm_instr) \ |
| 252 do { \ | 264 do { \ |
| 253 if (instr->InputAt(1)->IsDoubleRegister()) { \ | 265 if (instr->InputAt(1)->IsDoubleRegister()) { \ |
| 254 __ asm_instr(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \ | 266 __ asm_instr(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \ |
| 255 } else { \ | 267 } else { \ |
| 256 __ asm_instr(i.InputDoubleRegister(0), i.InputOperand(1)); \ | 268 __ asm_instr(i.InputDoubleRegister(0), i.InputOperand(1)); \ |
| 257 } \ | 269 } \ |
| 258 } while (0) | 270 } while (0) |
| 259 | 271 |
| 260 | 272 |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 case kAVXFloat64Sub: | 806 case kAVXFloat64Sub: |
| 795 ASSEMBLE_AVX_DOUBLE_BINOP(vsubsd); | 807 ASSEMBLE_AVX_DOUBLE_BINOP(vsubsd); |
| 796 break; | 808 break; |
| 797 case kAVXFloat64Mul: | 809 case kAVXFloat64Mul: |
| 798 ASSEMBLE_AVX_DOUBLE_BINOP(vmulsd); | 810 ASSEMBLE_AVX_DOUBLE_BINOP(vmulsd); |
| 799 break; | 811 break; |
| 800 case kAVXFloat64Div: | 812 case kAVXFloat64Div: |
| 801 ASSEMBLE_AVX_DOUBLE_BINOP(vdivsd); | 813 ASSEMBLE_AVX_DOUBLE_BINOP(vdivsd); |
| 802 break; | 814 break; |
| 803 case kX64Movsxbl: | 815 case kX64Movsxbl: |
| 804 if (instr->addressing_mode() != kMode_None) { | 816 ASSEMBLE_MOVX(movsxbl); |
| 805 __ movsxbl(i.OutputRegister(), i.MemoryOperand()); | |
| 806 } else if (instr->InputAt(0)->IsRegister()) { | |
| 807 __ movsxbl(i.OutputRegister(), i.InputRegister(0)); | |
| 808 } else { | |
| 809 __ movsxbl(i.OutputRegister(), i.InputOperand(0)); | |
| 810 } | |
| 811 __ AssertZeroExtended(i.OutputRegister()); | 817 __ AssertZeroExtended(i.OutputRegister()); |
| 812 break; | 818 break; |
| 813 case kX64Movzxbl: | 819 case kX64Movzxbl: |
| 814 __ movzxbl(i.OutputRegister(), i.MemoryOperand()); | 820 ASSEMBLE_MOVX(movzxbl); |
| 821 __ AssertZeroExtended(i.OutputRegister()); |
| 815 break; | 822 break; |
| 816 case kX64Movb: { | 823 case kX64Movb: { |
| 817 int index = 0; | 824 int index = 0; |
| 818 Operand operand = i.MemoryOperand(&index); | 825 Operand operand = i.MemoryOperand(&index); |
| 819 if (HasImmediateInput(instr, index)) { | 826 if (HasImmediateInput(instr, index)) { |
| 820 __ movb(operand, Immediate(i.InputInt8(index))); | 827 __ movb(operand, Immediate(i.InputInt8(index))); |
| 821 } else { | 828 } else { |
| 822 __ movb(operand, i.InputRegister(index)); | 829 __ movb(operand, i.InputRegister(index)); |
| 823 } | 830 } |
| 824 break; | 831 break; |
| 825 } | 832 } |
| 826 case kX64Movsxwl: | 833 case kX64Movsxwl: |
| 827 if (instr->addressing_mode() != kMode_None) { | 834 ASSEMBLE_MOVX(movsxwl); |
| 828 __ movsxwl(i.OutputRegister(), i.MemoryOperand()); | |
| 829 } else if (instr->InputAt(0)->IsRegister()) { | |
| 830 __ movsxwl(i.OutputRegister(), i.InputRegister(0)); | |
| 831 } else { | |
| 832 __ movsxwl(i.OutputRegister(), i.InputOperand(0)); | |
| 833 } | |
| 834 __ AssertZeroExtended(i.OutputRegister()); | 835 __ AssertZeroExtended(i.OutputRegister()); |
| 835 break; | 836 break; |
| 836 case kX64Movzxwl: | 837 case kX64Movzxwl: |
| 837 __ movzxwl(i.OutputRegister(), i.MemoryOperand()); | 838 ASSEMBLE_MOVX(movzxwl); |
| 838 __ AssertZeroExtended(i.OutputRegister()); | 839 __ AssertZeroExtended(i.OutputRegister()); |
| 839 break; | 840 break; |
| 840 case kX64Movw: { | 841 case kX64Movw: { |
| 841 int index = 0; | 842 int index = 0; |
| 842 Operand operand = i.MemoryOperand(&index); | 843 Operand operand = i.MemoryOperand(&index); |
| 843 if (HasImmediateInput(instr, index)) { | 844 if (HasImmediateInput(instr, index)) { |
| 844 __ movw(operand, Immediate(i.InputInt16(index))); | 845 __ movw(operand, Immediate(i.InputInt16(index))); |
| 845 } else { | 846 } else { |
| 846 __ movw(operand, i.InputRegister(index)); | 847 __ movw(operand, i.InputRegister(index)); |
| 847 } | 848 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 862 } else { | 863 } else { |
| 863 int index = 0; | 864 int index = 0; |
| 864 Operand operand = i.MemoryOperand(&index); | 865 Operand operand = i.MemoryOperand(&index); |
| 865 if (HasImmediateInput(instr, index)) { | 866 if (HasImmediateInput(instr, index)) { |
| 866 __ movl(operand, i.InputImmediate(index)); | 867 __ movl(operand, i.InputImmediate(index)); |
| 867 } else { | 868 } else { |
| 868 __ movl(operand, i.InputRegister(index)); | 869 __ movl(operand, i.InputRegister(index)); |
| 869 } | 870 } |
| 870 } | 871 } |
| 871 break; | 872 break; |
| 872 case kX64Movsxlq: { | 873 case kX64Movsxlq: |
| 873 if (instr->InputAt(0)->IsRegister()) { | 874 ASSEMBLE_MOVX(movsxlq); |
| 874 __ movsxlq(i.OutputRegister(), i.InputRegister(0)); | |
| 875 } else { | |
| 876 __ movsxlq(i.OutputRegister(), i.InputOperand(0)); | |
| 877 } | |
| 878 break; | 875 break; |
| 879 } | |
| 880 case kX64Movq: | 876 case kX64Movq: |
| 881 if (instr->HasOutput()) { | 877 if (instr->HasOutput()) { |
| 882 __ movq(i.OutputRegister(), i.MemoryOperand()); | 878 __ movq(i.OutputRegister(), i.MemoryOperand()); |
| 883 } else { | 879 } else { |
| 884 int index = 0; | 880 int index = 0; |
| 885 Operand operand = i.MemoryOperand(&index); | 881 Operand operand = i.MemoryOperand(&index); |
| 886 if (HasImmediateInput(instr, index)) { | 882 if (HasImmediateInput(instr, index)) { |
| 887 __ movq(operand, i.InputImmediate(index)); | 883 __ movq(operand, i.InputImmediate(index)); |
| 888 } else { | 884 } else { |
| 889 __ movq(operand, i.InputRegister(index)); | 885 __ movq(operand, i.InputRegister(index)); |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 } | 1433 } |
| 1438 } | 1434 } |
| 1439 MarkLazyDeoptSite(); | 1435 MarkLazyDeoptSite(); |
| 1440 } | 1436 } |
| 1441 | 1437 |
| 1442 #undef __ | 1438 #undef __ |
| 1443 | 1439 |
| 1444 } // namespace internal | 1440 } // namespace internal |
| 1445 } // namespace compiler | 1441 } // namespace compiler |
| 1446 } // namespace v8 | 1442 } // namespace v8 |
| OLD | NEW |