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 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 } else if (instr->arch_opcode() == kMipsCmpS) { | 1214 } else if (instr->arch_opcode() == kMipsCmpS) { |
1215 if (!convertCondition(branch->condition, cc)) { | 1215 if (!convertCondition(branch->condition, cc)) { |
1216 UNSUPPORTED_COND(kMips64CmpS, branch->condition); | 1216 UNSUPPORTED_COND(kMips64CmpS, branch->condition); |
1217 } | 1217 } |
1218 FPURegister left = i.InputOrZeroSingleRegister(0); | 1218 FPURegister left = i.InputOrZeroSingleRegister(0); |
1219 FPURegister right = i.InputOrZeroSingleRegister(1); | 1219 FPURegister right = i.InputOrZeroSingleRegister(1); |
1220 if ((left.is(kDoubleRegZero) || right.is(kDoubleRegZero)) && | 1220 if ((left.is(kDoubleRegZero) || right.is(kDoubleRegZero)) && |
1221 !__ IsDoubleZeroRegSet()) { | 1221 !__ IsDoubleZeroRegSet()) { |
1222 __ Move(kDoubleRegZero, 0.0); | 1222 __ Move(kDoubleRegZero, 0.0); |
1223 } | 1223 } |
1224 __ BranchF32(tlabel, NULL, cc, left, right); | 1224 __ BranchF32(tlabel, nullptr, cc, left, right); |
1225 } else if (instr->arch_opcode() == kMipsCmpD) { | 1225 } else if (instr->arch_opcode() == kMipsCmpD) { |
1226 if (!convertCondition(branch->condition, cc)) { | 1226 if (!convertCondition(branch->condition, cc)) { |
1227 UNSUPPORTED_COND(kMips64CmpD, branch->condition); | 1227 UNSUPPORTED_COND(kMips64CmpD, branch->condition); |
1228 } | 1228 } |
1229 FPURegister left = i.InputOrZeroDoubleRegister(0); | 1229 FPURegister left = i.InputOrZeroDoubleRegister(0); |
1230 FPURegister right = i.InputOrZeroDoubleRegister(1); | 1230 FPURegister right = i.InputOrZeroDoubleRegister(1); |
1231 if ((left.is(kDoubleRegZero) || right.is(kDoubleRegZero)) && | 1231 if ((left.is(kDoubleRegZero) || right.is(kDoubleRegZero)) && |
1232 !__ IsDoubleZeroRegSet()) { | 1232 !__ IsDoubleZeroRegSet()) { |
1233 __ Move(kDoubleRegZero, 0.0); | 1233 __ Move(kDoubleRegZero, 0.0); |
1234 } | 1234 } |
1235 __ BranchF64(tlabel, NULL, cc, left, right); | 1235 __ BranchF64(tlabel, nullptr, cc, left, right); |
1236 } else { | 1236 } else { |
1237 PrintF("AssembleArchBranch Unimplemented arch_opcode: %d\n", | 1237 PrintF("AssembleArchBranch Unimplemented arch_opcode: %d\n", |
1238 instr->arch_opcode()); | 1238 instr->arch_opcode()); |
1239 UNIMPLEMENTED(); | 1239 UNIMPLEMENTED(); |
1240 } | 1240 } |
1241 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. | 1241 if (!branch->fallthru) __ Branch(flabel); // no fallthru to flabel. |
1242 } | 1242 } |
1243 | 1243 |
1244 | 1244 |
1245 void CodeGenerator::AssembleArchJump(RpoNumber target) { | 1245 void CodeGenerator::AssembleArchJump(RpoNumber target) { |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 if (pop_count != 0) { | 1534 if (pop_count != 0) { |
1535 __ DropAndRet(pop_count); | 1535 __ DropAndRet(pop_count); |
1536 } else { | 1536 } else { |
1537 __ Ret(); | 1537 __ Ret(); |
1538 } | 1538 } |
1539 } | 1539 } |
1540 | 1540 |
1541 | 1541 |
1542 void CodeGenerator::AssembleMove(InstructionOperand* source, | 1542 void CodeGenerator::AssembleMove(InstructionOperand* source, |
1543 InstructionOperand* destination) { | 1543 InstructionOperand* destination) { |
1544 MipsOperandConverter g(this, NULL); | 1544 MipsOperandConverter g(this, nullptr); |
1545 // Dispatch on the source and destination operand kinds. Not all | 1545 // Dispatch on the source and destination operand kinds. Not all |
1546 // combinations are possible. | 1546 // combinations are possible. |
1547 if (source->IsRegister()) { | 1547 if (source->IsRegister()) { |
1548 DCHECK(destination->IsRegister() || destination->IsStackSlot()); | 1548 DCHECK(destination->IsRegister() || destination->IsStackSlot()); |
1549 Register src = g.ToRegister(source); | 1549 Register src = g.ToRegister(source); |
1550 if (destination->IsRegister()) { | 1550 if (destination->IsRegister()) { |
1551 __ mov(g.ToRegister(destination), src); | 1551 __ mov(g.ToRegister(destination), src); |
1552 } else { | 1552 } else { |
1553 __ sw(src, g.ToMemOperand(destination)); | 1553 __ sw(src, g.ToMemOperand(destination)); |
1554 } | 1554 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 __ sdc1(temp, g.ToMemOperand(destination)); | 1640 __ sdc1(temp, g.ToMemOperand(destination)); |
1641 } | 1641 } |
1642 } else { | 1642 } else { |
1643 UNREACHABLE(); | 1643 UNREACHABLE(); |
1644 } | 1644 } |
1645 } | 1645 } |
1646 | 1646 |
1647 | 1647 |
1648 void CodeGenerator::AssembleSwap(InstructionOperand* source, | 1648 void CodeGenerator::AssembleSwap(InstructionOperand* source, |
1649 InstructionOperand* destination) { | 1649 InstructionOperand* destination) { |
1650 MipsOperandConverter g(this, NULL); | 1650 MipsOperandConverter g(this, nullptr); |
1651 // Dispatch on the source and destination operand kinds. Not all | 1651 // Dispatch on the source and destination operand kinds. Not all |
1652 // combinations are possible. | 1652 // combinations are possible. |
1653 if (source->IsRegister()) { | 1653 if (source->IsRegister()) { |
1654 // Register-register. | 1654 // Register-register. |
1655 Register temp = kScratchReg; | 1655 Register temp = kScratchReg; |
1656 Register src = g.ToRegister(source); | 1656 Register src = g.ToRegister(source); |
1657 if (destination->IsRegister()) { | 1657 if (destination->IsRegister()) { |
1658 Register dst = g.ToRegister(destination); | 1658 Register dst = g.ToRegister(destination); |
1659 __ Move(temp, src); | 1659 __ Move(temp, src); |
1660 __ Move(src, dst); | 1660 __ Move(src, dst); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 padding_size -= v8::internal::Assembler::kInstrSize; | 1745 padding_size -= v8::internal::Assembler::kInstrSize; |
1746 } | 1746 } |
1747 } | 1747 } |
1748 } | 1748 } |
1749 | 1749 |
1750 #undef __ | 1750 #undef __ |
1751 | 1751 |
1752 } // namespace compiler | 1752 } // namespace compiler |
1753 } // namespace internal | 1753 } // namespace internal |
1754 } // namespace v8 | 1754 } // namespace v8 |
OLD | NEW |