Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Side by Side Diff: src/mips/macro-assembler-mips.h

Issue 1396133002: MIPS: r6 compact branch optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased, gcc build fixed, ra alignment failure fixed. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 1625
1624 // Jumps to found label if a prototype map has dictionary elements. 1626 // Jumps to found label if a prototype map has dictionary elements.
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 private: 1630 private:
1629 void CallCFunctionHelper(Register function, 1631 void CallCFunctionHelper(Register function,
1630 int num_reg_arguments, 1632 int num_reg_arguments,
1631 int num_double_arguments); 1633 int num_double_arguments);
1632 1634
1633 void BranchAndLinkShort(int16_t offset, BranchDelaySlot bdslot = PROTECT); 1635 Register GetRtAsRegisterHelper(const Operand& rt, Register scratch);
1634 void BranchAndLinkShort(int16_t offset, Condition cond, Register rs, 1636 inline int32_t GetOffset(int32_t offset, Label* L, int bits);
1635 const Operand& rt, 1637 void BranchShortHelperR6(int32_t offset, Label* L);
1636 BranchDelaySlot bdslot = PROTECT); 1638 void BranchShortHelper(int16_t offset, Label* L, BranchDelaySlot bdslot);
1639 void BranchShortHelperR6(int32_t offset, Label* L, Condition cond,
1640 Register rs, const Operand& rt);
1641 void BranchShortHelper(int16_t offset, Label* L, Condition cond, Register rs,
1642 const Operand& rt, BranchDelaySlot bdslot);
1643 void BranchAndLinkShortHelperR6(int32_t offset, Label* L);
1644 void BranchAndLinkShortHelper(int16_t offset, Label* L,
1645 BranchDelaySlot bdslot);
1646 void BranchAndLinkShort(int32_t offset, BranchDelaySlot bdslot = PROTECT);
1647 void BranchAndLinkShortHelperR6(int32_t offset, Label* L, Condition cond,
1648 Register rs, const Operand& rt);
1649 void BranchAndLinkShortHelper(int16_t offset, Label* L, Condition cond,
1650 Register rs, const Operand& rt,
1651 BranchDelaySlot bdslot);
1652 void BranchAndLinkShort(int32_t offset, Condition cond, Register rs,
1653 const Operand& rt, BranchDelaySlot bdslot = PROTECT);
1637 void BranchAndLinkShort(Label* L, BranchDelaySlot bdslot = PROTECT); 1654 void BranchAndLinkShort(Label* L, BranchDelaySlot bdslot = PROTECT);
1638 void BranchAndLinkShort(Label* L, Condition cond, Register rs, 1655 void BranchAndLinkShort(Label* L, Condition cond, Register rs,
1639 const Operand& rt, 1656 const Operand& rt,
1640 BranchDelaySlot bdslot = PROTECT); 1657 BranchDelaySlot bdslot = PROTECT);
1641 void Jr(Label* L, BranchDelaySlot bdslot); 1658 void Jr(Label* L, BranchDelaySlot bdslot);
1642 void Jalr(Label* L, BranchDelaySlot bdslot); 1659 void Jalr(Label* L, BranchDelaySlot bdslot);
1643 1660
1644 // Common implementation of BranchF functions for the different formats. 1661 // Common implementation of BranchF functions for the different formats.
1645 void BranchFCommon(SecondaryField sizeField, Label* target, Label* nan, 1662 void BranchFCommon(SecondaryField sizeField, Label* target, Label* nan,
1646 Condition cc, FPURegister cmp1, FPURegister cmp2, 1663 Condition cc, FPURegister cmp1, FPURegister cmp2,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 MacroAssembler* masm() { return &masm_; } 1734 MacroAssembler* masm() { return &masm_; }
1718 1735
1719 // Emit an instruction directly. 1736 // Emit an instruction directly.
1720 void Emit(Instr instr); 1737 void Emit(Instr instr);
1721 1738
1722 // Emit an address directly. 1739 // Emit an address directly.
1723 void Emit(Address addr); 1740 void Emit(Address addr);
1724 1741
1725 // Change the condition part of an instruction leaving the rest of the current 1742 // Change the condition part of an instruction leaving the rest of the current
1726 // instruction unchanged. 1743 // instruction unchanged.
1727 void ChangeBranchCondition(Condition cond); 1744 void ChangeBranchCondition();
1728 1745
1729 private: 1746 private:
1730 byte* address_; // The address of the code being patched. 1747 byte* address_; // The address of the code being patched.
1731 int size_; // Number of bytes of the expected patch size. 1748 int size_; // Number of bytes of the expected patch size.
1732 MacroAssembler masm_; // Macro assembler used to generate the code. 1749 MacroAssembler masm_; // Macro assembler used to generate the code.
1733 FlushICache flush_cache_; // Whether to flush the I cache after patching. 1750 FlushICache flush_cache_; // Whether to flush the I cache after patching.
1734 }; 1751 };
1735 1752
1736 1753
1737 1754
1738 #ifdef GENERATED_CODE_COVERAGE 1755 #ifdef GENERATED_CODE_COVERAGE
1739 #define CODE_COVERAGE_STRINGIFY(x) #x 1756 #define CODE_COVERAGE_STRINGIFY(x) #x
1740 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) 1757 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
1741 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 1758 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
1742 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> 1759 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
1743 #else 1760 #else
1744 #define ACCESS_MASM(masm) masm-> 1761 #define ACCESS_MASM(masm) masm->
1745 #endif 1762 #endif
1746 1763
1747 } // namespace internal 1764 } // namespace internal
1748 } // namespace v8 1765 } // namespace v8
1749 1766
1750 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ 1767 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698