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/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 #include "src/compiler/code-generator.h" | 6 #include "src/compiler/code-generator.h" |
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/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // TODO(plind): r6 address mode, to be implemented ... | 111 // TODO(plind): r6 address mode, to be implemented ... |
112 UNREACHABLE(); | 112 UNREACHABLE(); |
113 } | 113 } |
114 UNREACHABLE(); | 114 UNREACHABLE(); |
115 return MemOperand(no_reg); | 115 return MemOperand(no_reg); |
116 } | 116 } |
117 | 117 |
118 MemOperand MemoryOperand(size_t index = 0) { return MemoryOperand(&index); } | 118 MemOperand MemoryOperand(size_t index = 0) { return MemoryOperand(&index); } |
119 | 119 |
120 MemOperand ToMemOperand(InstructionOperand* op) const { | 120 MemOperand ToMemOperand(InstructionOperand* op) const { |
121 DCHECK(op != NULL); | 121 DCHECK_NOT_NULL(op); |
122 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); | 122 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
123 FrameOffset offset = frame_access_state()->GetFrameOffset( | 123 FrameOffset offset = frame_access_state()->GetFrameOffset( |
124 AllocatedOperand::cast(op)->index()); | 124 AllocatedOperand::cast(op)->index()); |
125 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset()); | 125 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset()); |
126 } | 126 } |
127 }; | 127 }; |
128 | 128 |
129 | 129 |
130 static inline bool HasRegisterInput(Instruction* instr, size_t index) { | 130 static inline bool HasRegisterInput(Instruction* instr, size_t index) { |
131 return instr->InputAt(index)->IsRegister(); | 131 return instr->InputAt(index)->IsRegister(); |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 } else if (instr->arch_opcode() == kMips64CmpS) { | 1440 } else if (instr->arch_opcode() == kMips64CmpS) { |
1441 if (!convertCondition(branch->condition, cc)) { | 1441 if (!convertCondition(branch->condition, cc)) { |
1442 UNSUPPORTED_COND(kMips64CmpS, branch->condition); | 1442 UNSUPPORTED_COND(kMips64CmpS, branch->condition); |
1443 } | 1443 } |
1444 FPURegister left = i.InputOrZeroSingleRegister(0); | 1444 FPURegister left = i.InputOrZeroSingleRegister(0); |
1445 FPURegister right = i.InputOrZeroSingleRegister(1); | 1445 FPURegister right = i.InputOrZeroSingleRegister(1); |
1446 if ((left.is(kDoubleRegZero) || right.is(kDoubleRegZero)) && | 1446 if ((left.is(kDoubleRegZero) || right.is(kDoubleRegZero)) && |
1447 !__ IsDoubleZeroRegSet()) { | 1447 !__ IsDoubleZeroRegSet()) { |
1448 __ Move(kDoubleRegZero, 0.0); | 1448 __ Move(kDoubleRegZero, 0.0); |
1449 } | 1449 } |
1450 __ BranchF32(tlabel, NULL, cc, left, right); | 1450 __ BranchF32(tlabel, nullptr, cc, left, right); |
1451 } else if (instr->arch_opcode() == kMips64CmpD) { | 1451 } else if (instr->arch_opcode() == kMips64CmpD) { |
1452 if (!convertCondition(branch->condition, cc)) { | 1452 if (!convertCondition(branch->condition, cc)) { |
1453 UNSUPPORTED_COND(kMips64CmpD, branch->condition); | 1453 UNSUPPORTED_COND(kMips64CmpD, branch->condition); |
1454 } | 1454 } |
1455 FPURegister left = i.InputOrZeroDoubleRegister(0); | 1455 FPURegister left = i.InputOrZeroDoubleRegister(0); |
1456 FPURegister right = i.InputOrZeroDoubleRegister(1); | 1456 FPURegister right = i.InputOrZeroDoubleRegister(1); |
1457 if ((left.is(kDoubleRegZero) || right.is(kDoubleRegZero)) && | 1457 if ((left.is(kDoubleRegZero) || right.is(kDoubleRegZero)) && |
1458 !__ IsDoubleZeroRegSet()) { | 1458 !__ IsDoubleZeroRegSet()) { |
1459 __ Move(kDoubleRegZero, 0.0); | 1459 __ Move(kDoubleRegZero, 0.0); |
1460 } | 1460 } |
1461 __ BranchF64(tlabel, NULL, cc, left, right); | 1461 __ BranchF64(tlabel, nullptr, cc, left, right); |
1462 } else { | 1462 } else { |
1463 PrintF("AssembleArchBranch Unimplemented arch_opcode: %d\n", | 1463 PrintF("AssembleArchBranch Unimplemented arch_opcode: %d\n", |
1464 instr->arch_opcode()); | 1464 instr->arch_opcode()); |
1465 UNIMPLEMENTED(); | 1465 UNIMPLEMENTED(); |
1466 } | 1466 } |
1467 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | 1467 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. |
1468 } | 1468 } |
1469 | 1469 |
1470 | 1470 |
1471 void CodeGenerator::AssembleArchJump(RpoNumber target) { | 1471 void CodeGenerator::AssembleArchJump(RpoNumber target) { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 if (pop_count != 0) { | 1771 if (pop_count != 0) { |
1772 __ DropAndRet(pop_count); | 1772 __ DropAndRet(pop_count); |
1773 } else { | 1773 } else { |
1774 __ Ret(); | 1774 __ Ret(); |
1775 } | 1775 } |
1776 } | 1776 } |
1777 | 1777 |
1778 | 1778 |
1779 void CodeGenerator::AssembleMove(InstructionOperand* source, | 1779 void CodeGenerator::AssembleMove(InstructionOperand* source, |
1780 InstructionOperand* destination) { | 1780 InstructionOperand* destination) { |
1781 MipsOperandConverter g(this, NULL); | 1781 MipsOperandConverter g(this, nullptr); |
1782 // Dispatch on the source and destination operand kinds. Not all | 1782 // Dispatch on the source and destination operand kinds. Not all |
1783 // combinations are possible. | 1783 // combinations are possible. |
1784 if (source->IsRegister()) { | 1784 if (source->IsRegister()) { |
1785 DCHECK(destination->IsRegister() || destination->IsStackSlot()); | 1785 DCHECK(destination->IsRegister() || destination->IsStackSlot()); |
1786 Register src = g.ToRegister(source); | 1786 Register src = g.ToRegister(source); |
1787 if (destination->IsRegister()) { | 1787 if (destination->IsRegister()) { |
1788 __ mov(g.ToRegister(destination), src); | 1788 __ mov(g.ToRegister(destination), src); |
1789 } else { | 1789 } else { |
1790 __ sd(src, g.ToMemOperand(destination)); | 1790 __ sd(src, g.ToMemOperand(destination)); |
1791 } | 1791 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 __ sdc1(temp, g.ToMemOperand(destination)); | 1877 __ sdc1(temp, g.ToMemOperand(destination)); |
1878 } | 1878 } |
1879 } else { | 1879 } else { |
1880 UNREACHABLE(); | 1880 UNREACHABLE(); |
1881 } | 1881 } |
1882 } | 1882 } |
1883 | 1883 |
1884 | 1884 |
1885 void CodeGenerator::AssembleSwap(InstructionOperand* source, | 1885 void CodeGenerator::AssembleSwap(InstructionOperand* source, |
1886 InstructionOperand* destination) { | 1886 InstructionOperand* destination) { |
1887 MipsOperandConverter g(this, NULL); | 1887 MipsOperandConverter g(this, nullptr); |
1888 // Dispatch on the source and destination operand kinds. Not all | 1888 // Dispatch on the source and destination operand kinds. Not all |
1889 // combinations are possible. | 1889 // combinations are possible. |
1890 if (source->IsRegister()) { | 1890 if (source->IsRegister()) { |
1891 // Register-register. | 1891 // Register-register. |
1892 Register temp = kScratchReg; | 1892 Register temp = kScratchReg; |
1893 Register src = g.ToRegister(source); | 1893 Register src = g.ToRegister(source); |
1894 if (destination->IsRegister()) { | 1894 if (destination->IsRegister()) { |
1895 Register dst = g.ToRegister(destination); | 1895 Register dst = g.ToRegister(destination); |
1896 __ Move(temp, src); | 1896 __ Move(temp, src); |
1897 __ Move(src, dst); | 1897 __ Move(src, dst); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 padding_size -= v8::internal::Assembler::kInstrSize; | 1982 padding_size -= v8::internal::Assembler::kInstrSize; |
1983 } | 1983 } |
1984 } | 1984 } |
1985 } | 1985 } |
1986 | 1986 |
1987 #undef __ | 1987 #undef __ |
1988 | 1988 |
1989 } // namespace compiler | 1989 } // namespace compiler |
1990 } // namespace internal | 1990 } // namespace internal |
1991 } // namespace v8 | 1991 } // namespace v8 |
OLD | NEW |