OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 5 #ifndef V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
6 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 6 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 #include "src/mips64/assembler-mips64.h" | 10 #include "src/mips64/assembler-mips64.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 } \ | 181 } \ |
182 void Name(target_type target, \ | 182 void Name(target_type target, \ |
183 COND_TYPED_ARGS, \ | 183 COND_TYPED_ARGS, \ |
184 BranchDelaySlot bd = PROTECT); \ | 184 BranchDelaySlot bd = PROTECT); \ |
185 inline void Name(BranchDelaySlot bd, \ | 185 inline void Name(BranchDelaySlot bd, \ |
186 target_type target, \ | 186 target_type target, \ |
187 COND_TYPED_ARGS) { \ | 187 COND_TYPED_ARGS) { \ |
188 Name(target, COND_ARGS, bd); \ | 188 Name(target, COND_ARGS, bd); \ |
189 } | 189 } |
190 | 190 |
191 #define DECLARE_BRANCH_PROTOTYPES(Name) \ | 191 #define DECLARE_BRANCH_PROTOTYPES(Name) \ |
192 DECLARE_NORELOC_PROTOTYPE(Name, Label*) \ | 192 DECLARE_NORELOC_PROTOTYPE(Name, Label*) \ |
193 DECLARE_NORELOC_PROTOTYPE(Name, int16_t) | 193 DECLARE_NORELOC_PROTOTYPE(Name, int32_t) |
194 | 194 |
195 DECLARE_BRANCH_PROTOTYPES(Branch) | 195 DECLARE_BRANCH_PROTOTYPES(Branch) |
196 DECLARE_BRANCH_PROTOTYPES(BranchAndLink) | 196 DECLARE_BRANCH_PROTOTYPES(BranchAndLink) |
197 DECLARE_BRANCH_PROTOTYPES(BranchShort) | 197 DECLARE_BRANCH_PROTOTYPES(BranchShort) |
198 | 198 |
199 #undef DECLARE_BRANCH_PROTOTYPES | 199 #undef DECLARE_BRANCH_PROTOTYPES |
200 #undef COND_TYPED_ARGS | 200 #undef COND_TYPED_ARGS |
201 #undef COND_ARGS | 201 #undef COND_ARGS |
202 | 202 |
203 | 203 |
(...skipping 16 matching lines...) Expand all Loading... |
220 void Call(Handle<Code> code, | 220 void Call(Handle<Code> code, |
221 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, | 221 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, |
222 TypeFeedbackId ast_id = TypeFeedbackId::None(), | 222 TypeFeedbackId ast_id = TypeFeedbackId::None(), |
223 COND_ARGS); | 223 COND_ARGS); |
224 void Ret(COND_ARGS); | 224 void Ret(COND_ARGS); |
225 inline void Ret(BranchDelaySlot bd, Condition cond = al, | 225 inline void Ret(BranchDelaySlot bd, Condition cond = al, |
226 Register rs = zero_reg, const Operand& rt = Operand(zero_reg)) { | 226 Register rs = zero_reg, const Operand& rt = Operand(zero_reg)) { |
227 Ret(cond, rs, rt, bd); | 227 Ret(cond, rs, rt, bd); |
228 } | 228 } |
229 | 229 |
| 230 bool IsNear(Label* L, Condition cond, int rs_reg); |
| 231 |
230 void Branch(Label* L, | 232 void Branch(Label* L, |
231 Condition cond, | 233 Condition cond, |
232 Register rs, | 234 Register rs, |
233 Heap::RootListIndex index, | 235 Heap::RootListIndex index, |
234 BranchDelaySlot bdslot = PROTECT); | 236 BranchDelaySlot bdslot = PROTECT); |
235 | 237 |
236 #undef COND_ARGS | 238 #undef COND_ARGS |
237 | 239 |
238 // Emit code to discard a non-negative number of pointer-sized elements | 240 // Emit code to discard a non-negative number of pointer-sized elements |
239 // from the stack, clobbering only the sp register. | 241 // from the stack, clobbering only the sp register. |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 void JumpIfDictionaryInPrototypeChain(Register object, Register scratch0, | 1767 void JumpIfDictionaryInPrototypeChain(Register object, Register scratch0, |
1766 Register scratch1, Label* found); | 1768 Register scratch1, Label* found); |
1767 | 1769 |
1768 bool IsDoubleZeroRegSet() { return has_double_zero_reg_set_; } | 1770 bool IsDoubleZeroRegSet() { return has_double_zero_reg_set_; } |
1769 | 1771 |
1770 private: | 1772 private: |
1771 void CallCFunctionHelper(Register function, | 1773 void CallCFunctionHelper(Register function, |
1772 int num_reg_arguments, | 1774 int num_reg_arguments, |
1773 int num_double_arguments); | 1775 int num_double_arguments); |
1774 | 1776 |
1775 void BranchAndLinkShort(int16_t offset, BranchDelaySlot bdslot = PROTECT); | 1777 inline Register GetRtAsRegisterHelper(const Operand& rt, Register scratch); |
1776 void BranchAndLinkShort(int16_t offset, Condition cond, Register rs, | 1778 inline int32_t GetOffset(int32_t offset, Label* L, OffsetSize bits); |
1777 const Operand& rt, | 1779 void BranchShortHelperR6(int32_t offset, Label* L); |
1778 BranchDelaySlot bdslot = PROTECT); | 1780 void BranchShortHelper(int16_t offset, Label* L, BranchDelaySlot bdslot); |
| 1781 bool BranchShortHelperR6(int32_t offset, Label* L, Condition cond, |
| 1782 Register rs, const Operand& rt); |
| 1783 bool BranchShortHelper(int16_t offset, Label* L, Condition cond, Register rs, |
| 1784 const Operand& rt, BranchDelaySlot bdslot); |
| 1785 bool BranchShortCheck(int32_t offset, Label* L, Condition cond, Register rs, |
| 1786 const Operand& rt, BranchDelaySlot bdslot); |
| 1787 |
| 1788 void BranchAndLinkShortHelperR6(int32_t offset, Label* L); |
| 1789 void BranchAndLinkShortHelper(int16_t offset, Label* L, |
| 1790 BranchDelaySlot bdslot); |
| 1791 void BranchAndLinkShort(int32_t offset, BranchDelaySlot bdslot = PROTECT); |
1779 void BranchAndLinkShort(Label* L, BranchDelaySlot bdslot = PROTECT); | 1792 void BranchAndLinkShort(Label* L, BranchDelaySlot bdslot = PROTECT); |
1780 void BranchAndLinkShort(Label* L, Condition cond, Register rs, | 1793 bool BranchAndLinkShortHelperR6(int32_t offset, Label* L, Condition cond, |
1781 const Operand& rt, | 1794 Register rs, const Operand& rt); |
1782 BranchDelaySlot bdslot = PROTECT); | 1795 bool BranchAndLinkShortHelper(int16_t offset, Label* L, Condition cond, |
1783 void J(Label* L, BranchDelaySlot bdslot); | 1796 Register rs, const Operand& rt, |
1784 void Jal(Label* L, BranchDelaySlot bdslot); | 1797 BranchDelaySlot bdslot); |
| 1798 bool BranchAndLinkShortCheck(int32_t offset, Label* L, Condition cond, |
| 1799 Register rs, const Operand& rt, |
| 1800 BranchDelaySlot bdslot); |
| 1801 void BranchLong(Label* L, BranchDelaySlot bdslot); |
| 1802 void BranchAndLinkLong(Label* L, BranchDelaySlot bdslot); |
1785 void Jr(Label* L, BranchDelaySlot bdslot); | 1803 void Jr(Label* L, BranchDelaySlot bdslot); |
1786 void Jalr(Label* L, BranchDelaySlot bdslot); | 1804 void Jalr(Label* L, BranchDelaySlot bdslot); |
1787 | 1805 |
1788 // Common implementation of BranchF functions for the different formats. | 1806 // Common implementation of BranchF functions for the different formats. |
1789 void BranchFCommon(SecondaryField sizeField, Label* target, Label* nan, | 1807 void BranchFCommon(SecondaryField sizeField, Label* target, Label* nan, |
1790 Condition cc, FPURegister cmp1, FPURegister cmp2, | 1808 Condition cc, FPURegister cmp1, FPURegister cmp2, |
1791 BranchDelaySlot bd = PROTECT); | 1809 BranchDelaySlot bd = PROTECT); |
1792 | 1810 |
1793 void BranchShortF(SecondaryField sizeField, Label* target, Condition cc, | 1811 void BranchShortF(SecondaryField sizeField, Label* target, Condition cc, |
1794 FPURegister cmp1, FPURegister cmp2, | 1812 FPURegister cmp1, FPURegister cmp2, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 MacroAssembler* masm() { return &masm_; } | 1877 MacroAssembler* masm() { return &masm_; } |
1860 | 1878 |
1861 // Emit an instruction directly. | 1879 // Emit an instruction directly. |
1862 void Emit(Instr instr); | 1880 void Emit(Instr instr); |
1863 | 1881 |
1864 // Emit an address directly. | 1882 // Emit an address directly. |
1865 void Emit(Address addr); | 1883 void Emit(Address addr); |
1866 | 1884 |
1867 // Change the condition part of an instruction leaving the rest of the current | 1885 // Change the condition part of an instruction leaving the rest of the current |
1868 // instruction unchanged. | 1886 // instruction unchanged. |
1869 void ChangeBranchCondition(Condition cond); | 1887 void ChangeBranchCondition(Instr current_instr, uint32_t new_opcode); |
1870 | 1888 |
1871 private: | 1889 private: |
1872 byte* address_; // The address of the code being patched. | 1890 byte* address_; // The address of the code being patched. |
1873 int size_; // Number of bytes of the expected patch size. | 1891 int size_; // Number of bytes of the expected patch size. |
1874 MacroAssembler masm_; // Macro assembler used to generate the code. | 1892 MacroAssembler masm_; // Macro assembler used to generate the code. |
1875 FlushICache flush_cache_; // Whether to flush the I cache after patching. | 1893 FlushICache flush_cache_; // Whether to flush the I cache after patching. |
1876 }; | 1894 }; |
1877 | 1895 |
1878 | 1896 |
1879 | 1897 |
1880 #ifdef GENERATED_CODE_COVERAGE | 1898 #ifdef GENERATED_CODE_COVERAGE |
1881 #define CODE_COVERAGE_STRINGIFY(x) #x | 1899 #define CODE_COVERAGE_STRINGIFY(x) #x |
1882 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1900 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1883 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1901 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1884 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1902 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1885 #else | 1903 #else |
1886 #define ACCESS_MASM(masm) masm-> | 1904 #define ACCESS_MASM(masm) masm-> |
1887 #endif | 1905 #endif |
1888 | 1906 |
1889 } // namespace internal | 1907 } // namespace internal |
1890 } // namespace v8 | 1908 } // namespace v8 |
1891 | 1909 |
1892 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1910 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
OLD | NEW |