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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } \ | 184 } \ |
185 void Name(target_type target, \ | 185 void Name(target_type target, \ |
186 COND_TYPED_ARGS, \ | 186 COND_TYPED_ARGS, \ |
187 BranchDelaySlot bd = PROTECT); \ | 187 BranchDelaySlot bd = PROTECT); \ |
188 inline void Name(BranchDelaySlot bd, \ | 188 inline void Name(BranchDelaySlot bd, \ |
189 target_type target, \ | 189 target_type target, \ |
190 COND_TYPED_ARGS) { \ | 190 COND_TYPED_ARGS) { \ |
191 Name(target, COND_ARGS, bd); \ | 191 Name(target, COND_ARGS, bd); \ |
192 } | 192 } |
193 | 193 |
194 #define DECLARE_BRANCH_PROTOTYPES(Name) \ | 194 #define DECLARE_BRANCH_PROTOTYPES(Name) \ |
195 DECLARE_NORELOC_PROTOTYPE(Name, Label*) \ | 195 DECLARE_NORELOC_PROTOTYPE(Name, Label*) \ |
196 DECLARE_NORELOC_PROTOTYPE(Name, int16_t) | 196 DECLARE_NORELOC_PROTOTYPE(Name, int32_t) |
197 | 197 |
198 DECLARE_BRANCH_PROTOTYPES(Branch) | 198 DECLARE_BRANCH_PROTOTYPES(Branch) |
199 DECLARE_BRANCH_PROTOTYPES(BranchAndLink) | 199 DECLARE_BRANCH_PROTOTYPES(BranchAndLink) |
200 DECLARE_BRANCH_PROTOTYPES(BranchShort) | 200 DECLARE_BRANCH_PROTOTYPES(BranchShort) |
201 | 201 |
202 #undef DECLARE_BRANCH_PROTOTYPES | 202 #undef DECLARE_BRANCH_PROTOTYPES |
203 #undef COND_TYPED_ARGS | 203 #undef COND_TYPED_ARGS |
204 #undef COND_ARGS | 204 #undef COND_ARGS |
205 | 205 |
206 | 206 |
(...skipping 16 matching lines...) Expand all Loading... |
223 void Call(Handle<Code> code, | 223 void Call(Handle<Code> code, |
224 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, | 224 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, |
225 TypeFeedbackId ast_id = TypeFeedbackId::None(), | 225 TypeFeedbackId ast_id = TypeFeedbackId::None(), |
226 COND_ARGS); | 226 COND_ARGS); |
227 void Ret(COND_ARGS); | 227 void Ret(COND_ARGS); |
228 inline void Ret(BranchDelaySlot bd, Condition cond = al, | 228 inline void Ret(BranchDelaySlot bd, Condition cond = al, |
229 Register rs = zero_reg, const Operand& rt = Operand(zero_reg)) { | 229 Register rs = zero_reg, const Operand& rt = Operand(zero_reg)) { |
230 Ret(cond, rs, rt, bd); | 230 Ret(cond, rs, rt, bd); |
231 } | 231 } |
232 | 232 |
| 233 bool IsNear(Label* L, Condition cond, int rs_reg); |
| 234 |
233 void Branch(Label* L, | 235 void Branch(Label* L, |
234 Condition cond, | 236 Condition cond, |
235 Register rs, | 237 Register rs, |
236 Heap::RootListIndex index, | 238 Heap::RootListIndex index, |
237 BranchDelaySlot bdslot = PROTECT); | 239 BranchDelaySlot bdslot = PROTECT); |
238 | 240 |
239 #undef COND_ARGS | 241 #undef COND_ARGS |
240 | 242 |
241 // Emit code to discard a non-negative number of pointer-sized elements | 243 // Emit code to discard a non-negative number of pointer-sized elements |
242 // from the stack, clobbering only the sp register. | 244 // from the stack, clobbering only the sp register. |
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 void JumpIfDictionaryInPrototypeChain(Register object, Register scratch0, | 1737 void JumpIfDictionaryInPrototypeChain(Register object, Register scratch0, |
1736 Register scratch1, Label* found); | 1738 Register scratch1, Label* found); |
1737 | 1739 |
1738 bool IsDoubleZeroRegSet() { return has_double_zero_reg_set_; } | 1740 bool IsDoubleZeroRegSet() { return has_double_zero_reg_set_; } |
1739 | 1741 |
1740 private: | 1742 private: |
1741 void CallCFunctionHelper(Register function, | 1743 void CallCFunctionHelper(Register function, |
1742 int num_reg_arguments, | 1744 int num_reg_arguments, |
1743 int num_double_arguments); | 1745 int num_double_arguments); |
1744 | 1746 |
1745 void BranchAndLinkShort(int16_t offset, BranchDelaySlot bdslot = PROTECT); | 1747 inline Register GetRtAsRegisterHelper(const Operand& rt, Register scratch); |
1746 void BranchAndLinkShort(int16_t offset, Condition cond, Register rs, | 1748 inline int32_t GetOffset(int32_t offset, Label* L, OffsetSize bits); |
1747 const Operand& rt, | 1749 void BranchShortHelperR6(int32_t offset, Label* L); |
1748 BranchDelaySlot bdslot = PROTECT); | 1750 void BranchShortHelper(int16_t offset, Label* L, BranchDelaySlot bdslot); |
| 1751 bool BranchShortHelperR6(int32_t offset, Label* L, Condition cond, |
| 1752 Register rs, const Operand& rt); |
| 1753 bool BranchShortHelper(int16_t offset, Label* L, Condition cond, Register rs, |
| 1754 const Operand& rt, BranchDelaySlot bdslot); |
| 1755 bool BranchShortCheck(int32_t offset, Label* L, Condition cond, Register rs, |
| 1756 const Operand& rt, BranchDelaySlot bdslot); |
| 1757 |
| 1758 void BranchAndLinkShortHelperR6(int32_t offset, Label* L); |
| 1759 void BranchAndLinkShortHelper(int16_t offset, Label* L, |
| 1760 BranchDelaySlot bdslot); |
| 1761 void BranchAndLinkShort(int32_t offset, BranchDelaySlot bdslot = PROTECT); |
1749 void BranchAndLinkShort(Label* L, BranchDelaySlot bdslot = PROTECT); | 1762 void BranchAndLinkShort(Label* L, BranchDelaySlot bdslot = PROTECT); |
1750 void BranchAndLinkShort(Label* L, Condition cond, Register rs, | 1763 bool BranchAndLinkShortHelperR6(int32_t offset, Label* L, Condition cond, |
1751 const Operand& rt, | 1764 Register rs, const Operand& rt); |
1752 BranchDelaySlot bdslot = PROTECT); | 1765 bool BranchAndLinkShortHelper(int16_t offset, Label* L, Condition cond, |
1753 void J(Label* L, BranchDelaySlot bdslot); | 1766 Register rs, const Operand& rt, |
1754 void Jal(Label* L, BranchDelaySlot bdslot); | 1767 BranchDelaySlot bdslot); |
| 1768 bool BranchAndLinkShortCheck(int32_t offset, Label* L, Condition cond, |
| 1769 Register rs, const Operand& rt, |
| 1770 BranchDelaySlot bdslot); |
| 1771 void BranchLong(Label* L, BranchDelaySlot bdslot); |
| 1772 void BranchAndLinkLong(Label* L, BranchDelaySlot bdslot); |
1755 void Jr(Label* L, BranchDelaySlot bdslot); | 1773 void Jr(Label* L, BranchDelaySlot bdslot); |
1756 void Jalr(Label* L, BranchDelaySlot bdslot); | 1774 void Jalr(Label* L, BranchDelaySlot bdslot); |
1757 | 1775 |
1758 // Common implementation of BranchF functions for the different formats. | 1776 // Common implementation of BranchF functions for the different formats. |
1759 void BranchFCommon(SecondaryField sizeField, Label* target, Label* nan, | 1777 void BranchFCommon(SecondaryField sizeField, Label* target, Label* nan, |
1760 Condition cc, FPURegister cmp1, FPURegister cmp2, | 1778 Condition cc, FPURegister cmp1, FPURegister cmp2, |
1761 BranchDelaySlot bd = PROTECT); | 1779 BranchDelaySlot bd = PROTECT); |
1762 | 1780 |
1763 void BranchShortF(SecondaryField sizeField, Label* target, Condition cc, | 1781 void BranchShortF(SecondaryField sizeField, Label* target, Condition cc, |
1764 FPURegister cmp1, FPURegister cmp2, | 1782 FPURegister cmp1, FPURegister cmp2, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 MacroAssembler* masm() { return &masm_; } | 1847 MacroAssembler* masm() { return &masm_; } |
1830 | 1848 |
1831 // Emit an instruction directly. | 1849 // Emit an instruction directly. |
1832 void Emit(Instr instr); | 1850 void Emit(Instr instr); |
1833 | 1851 |
1834 // Emit an address directly. | 1852 // Emit an address directly. |
1835 void Emit(Address addr); | 1853 void Emit(Address addr); |
1836 | 1854 |
1837 // Change the condition part of an instruction leaving the rest of the current | 1855 // Change the condition part of an instruction leaving the rest of the current |
1838 // instruction unchanged. | 1856 // instruction unchanged. |
1839 void ChangeBranchCondition(Condition cond); | 1857 void ChangeBranchCondition(Instr current_instr, uint32_t new_opcode); |
1840 | 1858 |
1841 private: | 1859 private: |
1842 byte* address_; // The address of the code being patched. | 1860 byte* address_; // The address of the code being patched. |
1843 int size_; // Number of bytes of the expected patch size. | 1861 int size_; // Number of bytes of the expected patch size. |
1844 MacroAssembler masm_; // Macro assembler used to generate the code. | 1862 MacroAssembler masm_; // Macro assembler used to generate the code. |
1845 FlushICache flush_cache_; // Whether to flush the I cache after patching. | 1863 FlushICache flush_cache_; // Whether to flush the I cache after patching. |
1846 }; | 1864 }; |
1847 | 1865 |
1848 | 1866 |
1849 | 1867 |
1850 #ifdef GENERATED_CODE_COVERAGE | 1868 #ifdef GENERATED_CODE_COVERAGE |
1851 #define CODE_COVERAGE_STRINGIFY(x) #x | 1869 #define CODE_COVERAGE_STRINGIFY(x) #x |
1852 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1870 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1853 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1871 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1854 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1872 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1855 #else | 1873 #else |
1856 #define ACCESS_MASM(masm) masm-> | 1874 #define ACCESS_MASM(masm) masm-> |
1857 #endif | 1875 #endif |
1858 | 1876 |
1859 } // namespace internal | 1877 } // namespace internal |
1860 } // namespace v8 | 1878 } // namespace v8 |
1861 | 1879 |
1862 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1880 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
OLD | NEW |