| 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
| 9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 UNREACHABLE(); | 95 UNREACHABLE(); |
| 96 return MemOperand(r0); | 96 return MemOperand(r0); |
| 97 } | 97 } |
| 98 | 98 |
| 99 MemOperand MemoryOperand(AddressingMode* mode, size_t first_index = 0) { | 99 MemOperand MemoryOperand(AddressingMode* mode, size_t first_index = 0) { |
| 100 return MemoryOperand(mode, &first_index); | 100 return MemoryOperand(mode, &first_index); |
| 101 } | 101 } |
| 102 | 102 |
| 103 MemOperand ToMemOperand(InstructionOperand* op) const { | 103 MemOperand ToMemOperand(InstructionOperand* op) const { |
| 104 DCHECK(op != NULL); | 104 DCHECK_NOT_NULL(op); |
| 105 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); | 105 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 106 FrameOffset offset = frame_access_state()->GetFrameOffset( | 106 FrameOffset offset = frame_access_state()->GetFrameOffset( |
| 107 AllocatedOperand::cast(op)->index()); | 107 AllocatedOperand::cast(op)->index()); |
| 108 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset()); | 108 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset()); |
| 109 } | 109 } |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 | 112 |
| 113 static inline bool HasRegisterInput(Instruction* instr, size_t index) { | 113 static inline bool HasRegisterInput(Instruction* instr, size_t index) { |
| 114 return instr->InputAt(index)->IsRegister(); | 114 return instr->InputAt(index)->IsRegister(); |
| (...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 } | 1633 } |
| 1634 } else { | 1634 } else { |
| 1635 __ Drop(pop_count); | 1635 __ Drop(pop_count); |
| 1636 } | 1636 } |
| 1637 __ Ret(); | 1637 __ Ret(); |
| 1638 } | 1638 } |
| 1639 | 1639 |
| 1640 | 1640 |
| 1641 void CodeGenerator::AssembleMove(InstructionOperand* source, | 1641 void CodeGenerator::AssembleMove(InstructionOperand* source, |
| 1642 InstructionOperand* destination) { | 1642 InstructionOperand* destination) { |
| 1643 PPCOperandConverter g(this, NULL); | 1643 PPCOperandConverter g(this, nullptr); |
| 1644 // Dispatch on the source and destination operand kinds. Not all | 1644 // Dispatch on the source and destination operand kinds. Not all |
| 1645 // combinations are possible. | 1645 // combinations are possible. |
| 1646 if (source->IsRegister()) { | 1646 if (source->IsRegister()) { |
| 1647 DCHECK(destination->IsRegister() || destination->IsStackSlot()); | 1647 DCHECK(destination->IsRegister() || destination->IsStackSlot()); |
| 1648 Register src = g.ToRegister(source); | 1648 Register src = g.ToRegister(source); |
| 1649 if (destination->IsRegister()) { | 1649 if (destination->IsRegister()) { |
| 1650 __ Move(g.ToRegister(destination), src); | 1650 __ Move(g.ToRegister(destination), src); |
| 1651 } else { | 1651 } else { |
| 1652 __ StoreP(src, g.ToMemOperand(destination), r0); | 1652 __ StoreP(src, g.ToMemOperand(destination), r0); |
| 1653 } | 1653 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 __ StoreDouble(temp, g.ToMemOperand(destination), r0); | 1735 __ StoreDouble(temp, g.ToMemOperand(destination), r0); |
| 1736 } | 1736 } |
| 1737 } else { | 1737 } else { |
| 1738 UNREACHABLE(); | 1738 UNREACHABLE(); |
| 1739 } | 1739 } |
| 1740 } | 1740 } |
| 1741 | 1741 |
| 1742 | 1742 |
| 1743 void CodeGenerator::AssembleSwap(InstructionOperand* source, | 1743 void CodeGenerator::AssembleSwap(InstructionOperand* source, |
| 1744 InstructionOperand* destination) { | 1744 InstructionOperand* destination) { |
| 1745 PPCOperandConverter g(this, NULL); | 1745 PPCOperandConverter g(this, nullptr); |
| 1746 // Dispatch on the source and destination operand kinds. Not all | 1746 // Dispatch on the source and destination operand kinds. Not all |
| 1747 // combinations are possible. | 1747 // combinations are possible. |
| 1748 if (source->IsRegister()) { | 1748 if (source->IsRegister()) { |
| 1749 // Register-register. | 1749 // Register-register. |
| 1750 Register temp = kScratchReg; | 1750 Register temp = kScratchReg; |
| 1751 Register src = g.ToRegister(source); | 1751 Register src = g.ToRegister(source); |
| 1752 if (destination->IsRegister()) { | 1752 if (destination->IsRegister()) { |
| 1753 Register dst = g.ToRegister(destination); | 1753 Register dst = g.ToRegister(destination); |
| 1754 __ mr(temp, src); | 1754 __ mr(temp, src); |
| 1755 __ mr(src, dst); | 1755 __ mr(src, dst); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1841 padding_size -= v8::internal::Assembler::kInstrSize; | 1841 padding_size -= v8::internal::Assembler::kInstrSize; |
| 1842 } | 1842 } |
| 1843 } | 1843 } |
| 1844 } | 1844 } |
| 1845 | 1845 |
| 1846 #undef __ | 1846 #undef __ |
| 1847 | 1847 |
| 1848 } // namespace compiler | 1848 } // namespace compiler |
| 1849 } // namespace internal | 1849 } // namespace internal |
| 1850 } // namespace v8 | 1850 } // namespace v8 |
| OLD | NEW |