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/mips/assembler-mips.h" | 10 #include "src/mips/assembler-mips.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } \ | 157 } \ |
158 void Name(target_type target, \ | 158 void Name(target_type target, \ |
159 COND_TYPED_ARGS, \ | 159 COND_TYPED_ARGS, \ |
160 BranchDelaySlot bd = PROTECT); \ | 160 BranchDelaySlot bd = PROTECT); \ |
161 inline void Name(BranchDelaySlot bd, \ | 161 inline void Name(BranchDelaySlot bd, \ |
162 target_type target, \ | 162 target_type target, \ |
163 COND_TYPED_ARGS) { \ | 163 COND_TYPED_ARGS) { \ |
164 Name(target, COND_ARGS, bd); \ | 164 Name(target, COND_ARGS, bd); \ |
165 } | 165 } |
166 | 166 |
167 #define DECLARE_BRANCH_PROTOTYPES(Name) \ | 167 #define DECLARE_BRANCH_PROTOTYPES(Name) \ |
168 DECLARE_NORELOC_PROTOTYPE(Name, Label*) \ | 168 DECLARE_NORELOC_PROTOTYPE(Name, Label*) \ |
169 DECLARE_NORELOC_PROTOTYPE(Name, int16_t) | 169 DECLARE_NORELOC_PROTOTYPE(Name, int32_t) |
170 | 170 |
171 DECLARE_BRANCH_PROTOTYPES(Branch) | 171 DECLARE_BRANCH_PROTOTYPES(Branch) |
172 DECLARE_BRANCH_PROTOTYPES(BranchAndLink) | 172 DECLARE_BRANCH_PROTOTYPES(BranchAndLink) |
173 DECLARE_BRANCH_PROTOTYPES(BranchShort) | 173 DECLARE_BRANCH_PROTOTYPES(BranchShort) |
174 | 174 |
175 #undef DECLARE_BRANCH_PROTOTYPES | 175 #undef DECLARE_BRANCH_PROTOTYPES |
176 #undef COND_TYPED_ARGS | 176 #undef COND_TYPED_ARGS |
177 #undef COND_ARGS | 177 #undef COND_ARGS |
178 | 178 |
179 | 179 |
(...skipping 16 matching lines...) Expand all Loading... |
196 void Call(Handle<Code> code, | 196 void Call(Handle<Code> code, |
197 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, | 197 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, |
198 TypeFeedbackId ast_id = TypeFeedbackId::None(), | 198 TypeFeedbackId ast_id = TypeFeedbackId::None(), |
199 COND_ARGS); | 199 COND_ARGS); |
200 void Ret(COND_ARGS); | 200 void Ret(COND_ARGS); |
201 inline void Ret(BranchDelaySlot bd, Condition cond = al, | 201 inline void Ret(BranchDelaySlot bd, Condition cond = al, |
202 Register rs = zero_reg, const Operand& rt = Operand(zero_reg)) { | 202 Register rs = zero_reg, const Operand& rt = Operand(zero_reg)) { |
203 Ret(cond, rs, rt, bd); | 203 Ret(cond, rs, rt, bd); |
204 } | 204 } |
205 | 205 |
| 206 bool IsNear(Label* L, Condition cond, int rs_reg); |
| 207 |
206 void Branch(Label* L, | 208 void Branch(Label* L, |
207 Condition cond, | 209 Condition cond, |
208 Register rs, | 210 Register rs, |
209 Heap::RootListIndex index, | 211 Heap::RootListIndex index, |
210 BranchDelaySlot bdslot = PROTECT); | 212 BranchDelaySlot bdslot = PROTECT); |
211 | 213 |
212 #undef COND_ARGS | 214 #undef COND_ARGS |
213 | 215 |
214 // Emit code to discard a non-negative number of pointer-sized elements | 216 // Emit code to discard a non-negative number of pointer-sized elements |
215 // from the stack, clobbering only the sp register. | 217 // from the stack, clobbering only the sp register. |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 void JumpIfDictionaryInPrototypeChain(Register object, Register scratch0, | 1627 void JumpIfDictionaryInPrototypeChain(Register object, Register scratch0, |
1626 Register scratch1, Label* found); | 1628 Register scratch1, Label* found); |
1627 | 1629 |
1628 bool IsDoubleZeroRegSet() { return has_double_zero_reg_set_; } | 1630 bool IsDoubleZeroRegSet() { return has_double_zero_reg_set_; } |
1629 | 1631 |
1630 private: | 1632 private: |
1631 void CallCFunctionHelper(Register function, | 1633 void CallCFunctionHelper(Register function, |
1632 int num_reg_arguments, | 1634 int num_reg_arguments, |
1633 int num_double_arguments); | 1635 int num_double_arguments); |
1634 | 1636 |
1635 void BranchAndLinkShort(int16_t offset, BranchDelaySlot bdslot = PROTECT); | 1637 inline Register GetRtAsRegisterHelper(const Operand& rt, Register scratch); |
1636 void BranchAndLinkShort(int16_t offset, Condition cond, Register rs, | 1638 inline int32_t GetOffset(int32_t offset, Label* L, OffsetSize bits); |
1637 const Operand& rt, | 1639 void BranchShortHelperR6(int32_t offset, Label* L); |
1638 BranchDelaySlot bdslot = PROTECT); | 1640 void BranchShortHelper(int16_t offset, Label* L, BranchDelaySlot bdslot); |
| 1641 bool BranchShortHelperR6(int32_t offset, Label* L, Condition cond, |
| 1642 Register rs, const Operand& rt); |
| 1643 bool BranchShortHelper(int16_t offset, Label* L, Condition cond, Register rs, |
| 1644 const Operand& rt, BranchDelaySlot bdslot); |
| 1645 bool BranchShortCheck(int32_t offset, Label* L, Condition cond, Register rs, |
| 1646 const Operand& rt, BranchDelaySlot bdslot); |
| 1647 |
| 1648 void BranchAndLinkShortHelperR6(int32_t offset, Label* L); |
| 1649 void BranchAndLinkShortHelper(int16_t offset, Label* L, |
| 1650 BranchDelaySlot bdslot); |
| 1651 void BranchAndLinkShort(int32_t offset, BranchDelaySlot bdslot = PROTECT); |
1639 void BranchAndLinkShort(Label* L, BranchDelaySlot bdslot = PROTECT); | 1652 void BranchAndLinkShort(Label* L, BranchDelaySlot bdslot = PROTECT); |
1640 void BranchAndLinkShort(Label* L, Condition cond, Register rs, | 1653 bool BranchAndLinkShortHelperR6(int32_t offset, Label* L, Condition cond, |
1641 const Operand& rt, | 1654 Register rs, const Operand& rt); |
1642 BranchDelaySlot bdslot = PROTECT); | 1655 bool BranchAndLinkShortHelper(int16_t offset, Label* L, Condition cond, |
| 1656 Register rs, const Operand& rt, |
| 1657 BranchDelaySlot bdslot); |
| 1658 bool BranchAndLinkShortCheck(int32_t offset, Label* L, Condition cond, |
| 1659 Register rs, const Operand& rt, |
| 1660 BranchDelaySlot bdslot); |
1643 void Jr(Label* L, BranchDelaySlot bdslot); | 1661 void Jr(Label* L, BranchDelaySlot bdslot); |
1644 void Jalr(Label* L, BranchDelaySlot bdslot); | 1662 void Jalr(Label* L, BranchDelaySlot bdslot); |
1645 | 1663 |
1646 // Common implementation of BranchF functions for the different formats. | 1664 // Common implementation of BranchF functions for the different formats. |
1647 void BranchFCommon(SecondaryField sizeField, Label* target, Label* nan, | 1665 void BranchFCommon(SecondaryField sizeField, Label* target, Label* nan, |
1648 Condition cc, FPURegister cmp1, FPURegister cmp2, | 1666 Condition cc, FPURegister cmp1, FPURegister cmp2, |
1649 BranchDelaySlot bd = PROTECT); | 1667 BranchDelaySlot bd = PROTECT); |
1650 | 1668 |
1651 void BranchShortF(SecondaryField sizeField, Label* target, Condition cc, | 1669 void BranchShortF(SecondaryField sizeField, Label* target, Condition cc, |
1652 FPURegister cmp1, FPURegister cmp2, | 1670 FPURegister cmp1, FPURegister cmp2, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 MacroAssembler* masm() { return &masm_; } | 1737 MacroAssembler* masm() { return &masm_; } |
1720 | 1738 |
1721 // Emit an instruction directly. | 1739 // Emit an instruction directly. |
1722 void Emit(Instr instr); | 1740 void Emit(Instr instr); |
1723 | 1741 |
1724 // Emit an address directly. | 1742 // Emit an address directly. |
1725 void Emit(Address addr); | 1743 void Emit(Address addr); |
1726 | 1744 |
1727 // Change the condition part of an instruction leaving the rest of the current | 1745 // Change the condition part of an instruction leaving the rest of the current |
1728 // instruction unchanged. | 1746 // instruction unchanged. |
1729 void ChangeBranchCondition(Condition cond); | 1747 void ChangeBranchCondition(Instr current_instr, uint32_t new_opcode); |
1730 | 1748 |
1731 private: | 1749 private: |
1732 byte* address_; // The address of the code being patched. | 1750 byte* address_; // The address of the code being patched. |
1733 int size_; // Number of bytes of the expected patch size. | 1751 int size_; // Number of bytes of the expected patch size. |
1734 MacroAssembler masm_; // Macro assembler used to generate the code. | 1752 MacroAssembler masm_; // Macro assembler used to generate the code. |
1735 FlushICache flush_cache_; // Whether to flush the I cache after patching. | 1753 FlushICache flush_cache_; // Whether to flush the I cache after patching. |
1736 }; | 1754 }; |
1737 | 1755 |
1738 | 1756 |
1739 | 1757 |
1740 #ifdef GENERATED_CODE_COVERAGE | 1758 #ifdef GENERATED_CODE_COVERAGE |
1741 #define CODE_COVERAGE_STRINGIFY(x) #x | 1759 #define CODE_COVERAGE_STRINGIFY(x) #x |
1742 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1760 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1743 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1761 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1744 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1762 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1745 #else | 1763 #else |
1746 #define ACCESS_MASM(masm) masm-> | 1764 #define ACCESS_MASM(masm) masm-> |
1747 #endif | 1765 #endif |
1748 | 1766 |
1749 } // namespace internal | 1767 } // namespace internal |
1750 } // namespace v8 | 1768 } // namespace v8 |
1751 | 1769 |
1752 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1770 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
OLD | NEW |