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

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

Issue 1628453002: MIPS: Use PC realitive instructions on r6. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 10 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
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 202
203 bool IsNear(Label* L, Condition cond, int rs_reg); 203 bool IsNear(Label* L, Condition cond, int rs_reg);
204 204
205 void Branch(Label* L, 205 void Branch(Label* L,
206 Condition cond, 206 Condition cond,
207 Register rs, 207 Register rs,
208 Heap::RootListIndex index, 208 Heap::RootListIndex index,
209 BranchDelaySlot bdslot = PROTECT); 209 BranchDelaySlot bdslot = PROTECT);
210 210
211 // GetLabelFunction must be lambda '[](size_t index) -> Label*' or a
212 // functor/function with 'Label *func(size_t index)' declaration.
213 template <typename Func>
214 void GenerateSwitchTable(Register index, size_t case_count,
215 Func GetLabelFunction);
211 #undef COND_ARGS 216 #undef COND_ARGS
212 217
213 // Emit code to discard a non-negative number of pointer-sized elements 218 // Emit code to discard a non-negative number of pointer-sized elements
214 // from the stack, clobbering only the sp register. 219 // from the stack, clobbering only the sp register.
215 void Drop(int count, 220 void Drop(int count,
216 Condition cond = cc_always, 221 Condition cond = cc_always,
217 Register reg = no_reg, 222 Register reg = no_reg,
218 const Operand& op = Operand(no_reg)); 223 const Operand& op = Operand(no_reg));
219 224
220 // Trivial case of DropAndRet that utilizes the delay slot and only emits 225 // Trivial case of DropAndRet that utilizes the delay slot and only emits
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 // instruction unchanged. 1744 // instruction unchanged.
1740 void ChangeBranchCondition(Instr current_instr, uint32_t new_opcode); 1745 void ChangeBranchCondition(Instr current_instr, uint32_t new_opcode);
1741 1746
1742 private: 1747 private:
1743 byte* address_; // The address of the code being patched. 1748 byte* address_; // The address of the code being patched.
1744 int size_; // Number of bytes of the expected patch size. 1749 int size_; // Number of bytes of the expected patch size.
1745 MacroAssembler masm_; // Macro assembler used to generate the code. 1750 MacroAssembler masm_; // Macro assembler used to generate the code.
1746 FlushICache flush_cache_; // Whether to flush the I cache after patching. 1751 FlushICache flush_cache_; // Whether to flush the I cache after patching.
1747 }; 1752 };
1748 1753
1749 1754 template <typename Func>
1755 void MacroAssembler::GenerateSwitchTable(Register index, size_t case_count,
1756 Func GetLabelFunction) {
1757 if (kArchVariant >= kMips32r6) {
1758 BlockTrampolinePoolFor(case_count + 5);
1759 addiupc(at, 5);
1760 lsa(at, at, index, kPointerSizeLog2);
1761 lw(at, MemOperand(at));
1762 } else {
1763 Label here;
1764 BlockTrampolinePoolFor(case_count + 6);
1765 bal(&here);
1766 sll(at, index, kPointerSizeLog2); // Branch delay slot.
1767 bind(&here);
1768 addu(at, at, ra);
1769 lw(at, MemOperand(at, 4 * v8::internal::Assembler::kInstrSize));
1770 }
1771 jr(at);
1772 nop(); // Branch delay slot nop.
1773 for (size_t index = 0; index < case_count; ++index) {
1774 dd(GetLabelFunction(index));
1775 }
1776 }
1750 1777
1751 #ifdef GENERATED_CODE_COVERAGE 1778 #ifdef GENERATED_CODE_COVERAGE
1752 #define CODE_COVERAGE_STRINGIFY(x) #x 1779 #define CODE_COVERAGE_STRINGIFY(x) #x
1753 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) 1780 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
1754 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 1781 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
1755 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> 1782 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
1756 #else 1783 #else
1757 #define ACCESS_MASM(masm) masm-> 1784 #define ACCESS_MASM(masm) masm->
1758 #endif 1785 #endif
1759 1786
1760 } // namespace internal 1787 } // namespace internal
1761 } // namespace v8 1788 } // namespace v8
1762 1789
1763 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ 1790 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698