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

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

Issue 2733503003: [assembler] Make register definitions constexpr (Closed)
Patch Set: [assembler] Make register definitions constexpr Created 3 years, 9 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/assembler-mips.h ('k') | src/mips64/assembler-mips64.h » ('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"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 // Give alias names to registers for calling conventions. 15 // Give alias names to registers for calling conventions.
16 const Register kReturnRegister0 = {Register::kCode_v0}; 16 constexpr Register kReturnRegister0 = {Register::kCode_v0};
17 const Register kReturnRegister1 = {Register::kCode_v1}; 17 constexpr Register kReturnRegister1 = {Register::kCode_v1};
18 const Register kReturnRegister2 = {Register::kCode_a0}; 18 constexpr Register kReturnRegister2 = {Register::kCode_a0};
19 const Register kJSFunctionRegister = {Register::kCode_a1}; 19 constexpr Register kJSFunctionRegister = {Register::kCode_a1};
20 const Register kContextRegister = {Register::kCpRegister}; 20 constexpr Register kContextRegister = {Register::kCpRegister};
21 const Register kAllocateSizeRegister = {Register::kCode_a0}; 21 constexpr Register kAllocateSizeRegister = {Register::kCode_a0};
22 const Register kInterpreterAccumulatorRegister = {Register::kCode_v0}; 22 constexpr Register kInterpreterAccumulatorRegister = {Register::kCode_v0};
23 const Register kInterpreterBytecodeOffsetRegister = {Register::kCode_t4}; 23 constexpr Register kInterpreterBytecodeOffsetRegister = {Register::kCode_t4};
24 const Register kInterpreterBytecodeArrayRegister = {Register::kCode_t5}; 24 constexpr Register kInterpreterBytecodeArrayRegister = {Register::kCode_t5};
25 const Register kInterpreterDispatchTableRegister = {Register::kCode_t6}; 25 constexpr Register kInterpreterDispatchTableRegister = {Register::kCode_t6};
26 const Register kJavaScriptCallArgCountRegister = {Register::kCode_a0}; 26 constexpr Register kJavaScriptCallArgCountRegister = {Register::kCode_a0};
27 const Register kJavaScriptCallNewTargetRegister = {Register::kCode_a3}; 27 constexpr Register kJavaScriptCallNewTargetRegister = {Register::kCode_a3};
28 const Register kRuntimeCallFunctionRegister = {Register::kCode_a1}; 28 constexpr Register kRuntimeCallFunctionRegister = {Register::kCode_a1};
29 const Register kRuntimeCallArgCountRegister = {Register::kCode_a0}; 29 constexpr Register kRuntimeCallArgCountRegister = {Register::kCode_a0};
30 30
31 // Forward declaration. 31 // Forward declaration.
32 class JumpTarget; 32 class JumpTarget;
33 33
34 // Reserved Register Usage Summary. 34 // Reserved Register Usage Summary.
35 // 35 //
36 // Registers t8, t9, and at are reserved for use by the MacroAssembler. 36 // Registers t8, t9, and at are reserved for use by the MacroAssembler.
37 // 37 //
38 // The programmer should know that the MacroAssembler may clobber these three, 38 // The programmer should know that the MacroAssembler may clobber these three,
39 // but won't touch other registers except in special cases. 39 // but won't touch other registers except in special cases.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Number of instructions needed for calculation of switch table entry address 211 // Number of instructions needed for calculation of switch table entry address
212 #ifdef _MIPS_ARCH_MIPS32R6 212 #ifdef _MIPS_ARCH_MIPS32R6
213 static const int kSwitchTablePrologueSize = 5; 213 static constexpr int kSwitchTablePrologueSize = 5;
214 #else 214 #else
215 static const int kSwitchTablePrologueSize = 10; 215 static constexpr int kSwitchTablePrologueSize = 10;
216 #endif 216 #endif
217 // GetLabelFunction must be lambda '[](size_t index) -> Label*' or a 217 // GetLabelFunction must be lambda '[](size_t index) -> Label*' or a
218 // functor/function with 'Label *func(size_t index)' declaration. 218 // functor/function with 'Label *func(size_t index)' declaration.
219 template <typename Func> 219 template <typename Func>
220 void GenerateSwitchTable(Register index, size_t case_count, 220 void GenerateSwitchTable(Register index, size_t case_count,
221 Func GetLabelFunction); 221 Func GetLabelFunction);
222 #undef COND_ARGS 222 #undef COND_ARGS
223 223
224 // Emit code that loads |parameter_index|'th parameter from the stack to 224 // Emit code that loads |parameter_index|'th parameter from the stack to
225 // the register according to the CallInterfaceDescriptor definition. 225 // the register according to the CallInterfaceDescriptor definition.
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 Ext(dst, src, Field::kShift, Field::kSize); 1625 Ext(dst, src, Field::kShift, Field::kSize);
1626 } 1626 }
1627 1627
1628 template<typename Field> 1628 template<typename Field>
1629 void DecodeField(Register reg) { 1629 void DecodeField(Register reg) {
1630 DecodeField<Field>(reg, reg); 1630 DecodeField<Field>(reg, reg);
1631 } 1631 }
1632 1632
1633 template<typename Field> 1633 template<typename Field>
1634 void DecodeFieldToSmi(Register dst, Register src) { 1634 void DecodeFieldToSmi(Register dst, Register src) {
1635 static const int shift = Field::kShift; 1635 constexpr int shift = Field::kShift;
1636 static const int mask = Field::kMask >> shift << kSmiTagSize; 1636 constexpr int mask = Field::kMask >> shift << kSmiTagSize;
1637 STATIC_ASSERT((mask & (0x80000000u >> (kSmiTagSize - 1))) == 0); 1637 STATIC_ASSERT((mask & (0x80000000u >> (kSmiTagSize - 1))) == 0);
1638 STATIC_ASSERT(kSmiTag == 0); 1638 STATIC_ASSERT(kSmiTag == 0);
1639 if (shift < kSmiTagSize) { 1639 if (shift < kSmiTagSize) {
1640 sll(dst, src, kSmiTagSize - shift); 1640 sll(dst, src, kSmiTagSize - shift);
1641 And(dst, dst, Operand(mask)); 1641 And(dst, dst, Operand(mask));
1642 } else if (shift > kSmiTagSize) { 1642 } else if (shift > kSmiTagSize) {
1643 srl(dst, src, shift - kSmiTagSize); 1643 srl(dst, src, shift - kSmiTagSize);
1644 And(dst, dst, Operand(mask)); 1644 And(dst, dst, Operand(mask));
1645 } else { 1645 } else {
1646 And(dst, src, Operand(mask)); 1646 And(dst, src, Operand(mask));
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 dd(GetLabelFunction(index)); 1821 dd(GetLabelFunction(index));
1822 } 1822 }
1823 } 1823 }
1824 1824
1825 #define ACCESS_MASM(masm) masm-> 1825 #define ACCESS_MASM(masm) masm->
1826 1826
1827 } // namespace internal 1827 } // namespace internal
1828 } // namespace v8 1828 } // namespace v8
1829 1829
1830 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ 1830 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.h ('k') | src/mips64/assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698