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/compilation-info.h" | 8 #include "src/compilation-info.h" |
9 #include "src/compiler/code-generator-impl.h" | 9 #include "src/compiler/code-generator-impl.h" |
10 #include "src/compiler/gap-resolver.h" | 10 #include "src/compiler/gap-resolver.h" |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 int deopt_state_id = | 752 int deopt_state_id = |
753 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 753 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
754 Deoptimizer::BailoutType bailout_type = | 754 Deoptimizer::BailoutType bailout_type = |
755 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 755 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
756 CodeGenResult result = AssembleDeoptimizerCall( | 756 CodeGenResult result = AssembleDeoptimizerCall( |
757 deopt_state_id, bailout_type, current_source_position_); | 757 deopt_state_id, bailout_type, current_source_position_); |
758 if (result != kSuccess) return result; | 758 if (result != kSuccess) return result; |
759 break; | 759 break; |
760 } | 760 } |
761 case kArchRet: | 761 case kArchRet: |
762 AssembleReturn(); | 762 AssembleReturn(instr->InputAt(0)); |
763 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 763 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
764 break; | 764 break; |
765 case kArchStackPointer: | 765 case kArchStackPointer: |
766 __ mov(i.OutputRegister(), sp); | 766 __ mov(i.OutputRegister(), sp); |
767 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 767 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
768 break; | 768 break; |
769 case kArchFramePointer: | 769 case kArchFramePointer: |
770 __ mov(i.OutputRegister(), fp); | 770 __ mov(i.OutputRegister(), fp); |
771 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 771 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
772 break; | 772 break; |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 } | 1745 } |
1746 const RegList saves = FLAG_enable_embedded_constant_pool | 1746 const RegList saves = FLAG_enable_embedded_constant_pool |
1747 ? (descriptor->CalleeSavedRegisters() & ~pp.bit()) | 1747 ? (descriptor->CalleeSavedRegisters() & ~pp.bit()) |
1748 : descriptor->CalleeSavedRegisters(); | 1748 : descriptor->CalleeSavedRegisters(); |
1749 if (saves != 0) { | 1749 if (saves != 0) { |
1750 // Save callee-saved registers. | 1750 // Save callee-saved registers. |
1751 __ stm(db_w, sp, saves); | 1751 __ stm(db_w, sp, saves); |
1752 } | 1752 } |
1753 } | 1753 } |
1754 | 1754 |
1755 | 1755 void CodeGenerator::AssembleReturn(InstructionOperand* pop) { |
1756 void CodeGenerator::AssembleReturn() { | |
1757 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1756 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1758 int pop_count = static_cast<int>(descriptor->StackParameterCount()); | 1757 int pop_count = static_cast<int>(descriptor->StackParameterCount()); |
1759 | 1758 |
1760 // Restore registers. | 1759 // Restore registers. |
1761 const RegList saves = FLAG_enable_embedded_constant_pool | 1760 const RegList saves = FLAG_enable_embedded_constant_pool |
1762 ? (descriptor->CalleeSavedRegisters() & ~pp.bit()) | 1761 ? (descriptor->CalleeSavedRegisters() & ~pp.bit()) |
1763 : descriptor->CalleeSavedRegisters(); | 1762 : descriptor->CalleeSavedRegisters(); |
1764 if (saves != 0) { | 1763 if (saves != 0) { |
1765 __ ldm(ia_w, sp, saves); | 1764 __ ldm(ia_w, sp, saves); |
1766 } | 1765 } |
(...skipping 15 matching lines...) Expand all Loading... |
1782 } else if (frame_access_state()->has_frame()) { | 1781 } else if (frame_access_state()->has_frame()) { |
1783 // Canonicalize JSFunction return sites for now. | 1782 // Canonicalize JSFunction return sites for now. |
1784 if (return_label_.is_bound()) { | 1783 if (return_label_.is_bound()) { |
1785 __ b(&return_label_); | 1784 __ b(&return_label_); |
1786 return; | 1785 return; |
1787 } else { | 1786 } else { |
1788 __ bind(&return_label_); | 1787 __ bind(&return_label_); |
1789 AssembleDeconstructFrame(); | 1788 AssembleDeconstructFrame(); |
1790 } | 1789 } |
1791 } | 1790 } |
1792 __ Ret(pop_count); | 1791 |
| 1792 ArmOperandConverter g(this, nullptr); |
| 1793 if (pop->IsImmediate()) { |
| 1794 DCHECK_EQ(Constant::kInt32, g.ToConstant(pop).type()); |
| 1795 pop_count += g.ToConstant(pop).ToInt32(); |
| 1796 } else { |
| 1797 __ Drop(g.ToRegister(pop)); |
| 1798 } |
| 1799 __ Drop(pop_count); |
| 1800 __ Ret(); |
1793 } | 1801 } |
1794 | 1802 |
1795 | 1803 |
1796 void CodeGenerator::AssembleMove(InstructionOperand* source, | 1804 void CodeGenerator::AssembleMove(InstructionOperand* source, |
1797 InstructionOperand* destination) { | 1805 InstructionOperand* destination) { |
1798 ArmOperandConverter g(this, nullptr); | 1806 ArmOperandConverter g(this, nullptr); |
1799 // Dispatch on the source and destination operand kinds. Not all | 1807 // Dispatch on the source and destination operand kinds. Not all |
1800 // combinations are possible. | 1808 // combinations are possible. |
1801 if (source->IsRegister()) { | 1809 if (source->IsRegister()) { |
1802 DCHECK(destination->IsRegister() || destination->IsStackSlot()); | 1810 DCHECK(destination->IsRegister() || destination->IsStackSlot()); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 padding_size -= v8::internal::Assembler::kInstrSize; | 2002 padding_size -= v8::internal::Assembler::kInstrSize; |
1995 } | 2003 } |
1996 } | 2004 } |
1997 } | 2005 } |
1998 | 2006 |
1999 #undef __ | 2007 #undef __ |
2000 | 2008 |
2001 } // namespace compiler | 2009 } // namespace compiler |
2002 } // namespace internal | 2010 } // namespace internal |
2003 } // namespace v8 | 2011 } // namespace v8 |
OLD | NEW |