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/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/arm64/macro-assembler-arm64.h" | 8 #include "src/arm64/macro-assembler-arm64.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 int deopt_state_id = | 779 int deopt_state_id = |
780 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 780 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
781 Deoptimizer::BailoutType bailout_type = | 781 Deoptimizer::BailoutType bailout_type = |
782 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 782 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
783 CodeGenResult result = AssembleDeoptimizerCall( | 783 CodeGenResult result = AssembleDeoptimizerCall( |
784 deopt_state_id, bailout_type, current_source_position_); | 784 deopt_state_id, bailout_type, current_source_position_); |
785 if (result != kSuccess) return result; | 785 if (result != kSuccess) return result; |
786 break; | 786 break; |
787 } | 787 } |
788 case kArchRet: | 788 case kArchRet: |
789 AssembleReturn(); | 789 AssembleReturn(instr->InputAt(0)); |
790 break; | 790 break; |
791 case kArchStackPointer: | 791 case kArchStackPointer: |
792 __ mov(i.OutputRegister(), masm()->StackPointer()); | 792 __ mov(i.OutputRegister(), masm()->StackPointer()); |
793 break; | 793 break; |
794 case kArchFramePointer: | 794 case kArchFramePointer: |
795 __ mov(i.OutputRegister(), fp); | 795 __ mov(i.OutputRegister(), fp); |
796 break; | 796 break; |
797 case kArchParentFramePointer: | 797 case kArchParentFramePointer: |
798 if (frame_access_state()->has_frame()) { | 798 if (frame_access_state()->has_frame()) { |
799 __ ldr(i.OutputRegister(), MemOperand(fp, 0)); | 799 __ ldr(i.OutputRegister(), MemOperand(fp, 0)); |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 // CPURegList::GetCalleeSaved(): x30 is missing. | 1850 // CPURegList::GetCalleeSaved(): x30 is missing. |
1851 // DCHECK(saves.list() == CPURegList::GetCalleeSaved().list()); | 1851 // DCHECK(saves.list() == CPURegList::GetCalleeSaved().list()); |
1852 CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits, | 1852 CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits, |
1853 descriptor->CalleeSavedRegisters()); | 1853 descriptor->CalleeSavedRegisters()); |
1854 saved_count = saves.Count(); | 1854 saved_count = saves.Count(); |
1855 if (saved_count != 0) { | 1855 if (saved_count != 0) { |
1856 __ PushCPURegList(saves); | 1856 __ PushCPURegList(saves); |
1857 } | 1857 } |
1858 } | 1858 } |
1859 | 1859 |
1860 | 1860 void CodeGenerator::AssembleReturn(InstructionOperand* pop) { |
1861 void CodeGenerator::AssembleReturn() { | |
1862 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1861 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1863 | 1862 |
1864 // Restore registers. | 1863 // Restore registers. |
1865 CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits, | 1864 CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits, |
1866 descriptor->CalleeSavedRegisters()); | 1865 descriptor->CalleeSavedRegisters()); |
1867 if (saves.Count() != 0) { | 1866 if (saves.Count() != 0) { |
1868 __ PopCPURegList(saves); | 1867 __ PopCPURegList(saves); |
1869 } | 1868 } |
1870 | 1869 |
1871 // Restore fp registers. | 1870 // Restore fp registers. |
(...skipping 16 matching lines...) Expand all Loading... |
1888 } else { | 1887 } else { |
1889 __ Bind(&return_label_); | 1888 __ Bind(&return_label_); |
1890 AssembleDeconstructFrame(); | 1889 AssembleDeconstructFrame(); |
1891 if (descriptor->UseNativeStack()) { | 1890 if (descriptor->UseNativeStack()) { |
1892 pop_count += (pop_count & 1); // align | 1891 pop_count += (pop_count & 1); // align |
1893 } | 1892 } |
1894 } | 1893 } |
1895 } else if (descriptor->UseNativeStack()) { | 1894 } else if (descriptor->UseNativeStack()) { |
1896 pop_count += (pop_count & 1); // align | 1895 pop_count += (pop_count & 1); // align |
1897 } | 1896 } |
| 1897 |
| 1898 Arm64OperandConverter g(this, nullptr); |
| 1899 if (pop->IsImmediate()) { |
| 1900 DCHECK_EQ(Constant::kInt32, g.ToConstant(pop).type()); |
| 1901 pop_count += g.ToConstant(pop).ToInt32(); |
| 1902 } else { |
| 1903 __ Drop(g.ToRegister(pop)); |
| 1904 } |
1898 __ Drop(pop_count); | 1905 __ Drop(pop_count); |
1899 | 1906 |
1900 if (descriptor->UseNativeStack()) { | 1907 if (descriptor->UseNativeStack()) { |
1901 __ AssertCspAligned(); | 1908 __ AssertCspAligned(); |
1902 } | 1909 } |
1903 __ Ret(); | 1910 __ Ret(); |
1904 } | 1911 } |
1905 | 1912 |
1906 | 1913 |
1907 void CodeGenerator::AssembleMove(InstructionOperand* source, | 1914 void CodeGenerator::AssembleMove(InstructionOperand* source, |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 padding_size -= kInstructionSize; | 2095 padding_size -= kInstructionSize; |
2089 } | 2096 } |
2090 } | 2097 } |
2091 } | 2098 } |
2092 | 2099 |
2093 #undef __ | 2100 #undef __ |
2094 | 2101 |
2095 } // namespace compiler | 2102 } // namespace compiler |
2096 } // namespace internal | 2103 } // namespace internal |
2097 } // namespace v8 | 2104 } // namespace v8 |
OLD | NEW |