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

Side by Side Diff: src/mips/constants-mips.h

Issue 8680013: Remove the static qualifier from functions in header files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Restored static const references on ARM and MIPS. Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #ifdef _MIPS_ARCH_MIPS32R2 43 #ifdef _MIPS_ARCH_MIPS32R2
44 #define mips32r2 1 44 #define mips32r2 1
45 #else 45 #else
46 #define mips32r2 0 46 #define mips32r2 0
47 #endif 47 #endif
48 48
49 49
50 #if(defined(__mips_hard_float) && __mips_hard_float != 0) 50 #if(defined(__mips_hard_float) && __mips_hard_float != 0)
51 // Use floating-point coprocessor instructions. This flag is raised when 51 // Use floating-point coprocessor instructions. This flag is raised when
52 // -mhard-float is passed to the compiler. 52 // -mhard-float is passed to the compiler.
53 static const bool IsMipsSoftFloatABI = false; 53 const bool IsMipsSoftFloatABI = false;
54 #elif(defined(__mips_soft_float) && __mips_soft_float != 0) 54 #elif(defined(__mips_soft_float) && __mips_soft_float != 0)
55 // Not using floating-point coprocessor instructions. This flag is raised when 55 // Not using floating-point coprocessor instructions. This flag is raised when
56 // -msoft-float is passed to the compiler. 56 // -msoft-float is passed to the compiler.
57 static const bool IsMipsSoftFloatABI = true; 57 const bool IsMipsSoftFloatABI = true;
58 #else 58 #else
59 static const bool IsMipsSoftFloatABI = true; 59 const bool IsMipsSoftFloatABI = true;
60 #endif 60 #endif
61 61
62 62
63 // Defines constants and accessor classes to assemble, disassemble and 63 // Defines constants and accessor classes to assemble, disassemble and
64 // simulate MIPS32 instructions. 64 // simulate MIPS32 instructions.
65 // 65 //
66 // See: MIPS32 Architecture For Programmers 66 // See: MIPS32 Architecture For Programmers
67 // Volume II: The MIPS32 Instruction Set 67 // Volume II: The MIPS32 Instruction Set
68 // Try www.cs.cornell.edu/courses/cs3410/2008fa/MIPS_Vol2.pdf. 68 // Try www.cs.cornell.edu/courses/cs3410/2008fa/MIPS_Vol2.pdf.
69 69
70 namespace v8 { 70 namespace v8 {
71 namespace internal { 71 namespace internal {
72 72
73 // ----------------------------------------------------------------------------- 73 // -----------------------------------------------------------------------------
74 // Registers and FPURegisters. 74 // Registers and FPURegisters.
75 75
76 // Number of general purpose registers. 76 // Number of general purpose registers.
77 static const int kNumRegisters = 32; 77 const int kNumRegisters = 32;
78 static const int kInvalidRegister = -1; 78 const int kInvalidRegister = -1;
79 79
80 // Number of registers with HI, LO, and pc. 80 // Number of registers with HI, LO, and pc.
81 static const int kNumSimuRegisters = 35; 81 const int kNumSimuRegisters = 35;
82 82
83 // In the simulator, the PC register is simulated as the 34th register. 83 // In the simulator, the PC register is simulated as the 34th register.
84 static const int kPCRegister = 34; 84 const int kPCRegister = 34;
85 85
86 // Number coprocessor registers. 86 // Number coprocessor registers.
87 static const int kNumFPURegisters = 32; 87 const int kNumFPURegisters = 32;
88 static const int kInvalidFPURegister = -1; 88 const int kInvalidFPURegister = -1;
89 89
90 // FPU (coprocessor 1) control registers. Currently only FCSR is implemented. 90 // FPU (coprocessor 1) control registers. Currently only FCSR is implemented.
91 static const int kFCSRRegister = 31; 91 const int kFCSRRegister = 31;
92 static const int kInvalidFPUControlRegister = -1; 92 const int kInvalidFPUControlRegister = -1;
93 static const uint32_t kFPUInvalidResult = (uint32_t) (1 << 31) - 1; 93 const uint32_t kFPUInvalidResult = (uint32_t) (1 << 31) - 1;
94 94
95 // FCSR constants. 95 // FCSR constants.
96 static const uint32_t kFCSRInexactFlagBit = 2; 96 const uint32_t kFCSRInexactFlagBit = 2;
97 static const uint32_t kFCSRUnderflowFlagBit = 3; 97 const uint32_t kFCSRUnderflowFlagBit = 3;
98 static const uint32_t kFCSROverflowFlagBit = 4; 98 const uint32_t kFCSROverflowFlagBit = 4;
99 static const uint32_t kFCSRDivideByZeroFlagBit = 5; 99 const uint32_t kFCSRDivideByZeroFlagBit = 5;
100 static const uint32_t kFCSRInvalidOpFlagBit = 6; 100 const uint32_t kFCSRInvalidOpFlagBit = 6;
101 101
102 static const uint32_t kFCSRInexactFlagMask = 1 << kFCSRInexactFlagBit; 102 const uint32_t kFCSRInexactFlagMask = 1 << kFCSRInexactFlagBit;
103 static const uint32_t kFCSRUnderflowFlagMask = 1 << kFCSRUnderflowFlagBit; 103 const uint32_t kFCSRUnderflowFlagMask = 1 << kFCSRUnderflowFlagBit;
104 static const uint32_t kFCSROverflowFlagMask = 1 << kFCSROverflowFlagBit; 104 const uint32_t kFCSROverflowFlagMask = 1 << kFCSROverflowFlagBit;
105 static const uint32_t kFCSRDivideByZeroFlagMask = 1 << kFCSRDivideByZeroFlagBit; 105 const uint32_t kFCSRDivideByZeroFlagMask = 1 << kFCSRDivideByZeroFlagBit;
106 static const uint32_t kFCSRInvalidOpFlagMask = 1 << kFCSRInvalidOpFlagBit; 106 const uint32_t kFCSRInvalidOpFlagMask = 1 << kFCSRInvalidOpFlagBit;
107 107
108 static const uint32_t kFCSRFlagMask = 108 const uint32_t kFCSRFlagMask =
109 kFCSRInexactFlagMask | 109 kFCSRInexactFlagMask |
110 kFCSRUnderflowFlagMask | 110 kFCSRUnderflowFlagMask |
111 kFCSROverflowFlagMask | 111 kFCSROverflowFlagMask |
112 kFCSRDivideByZeroFlagMask | 112 kFCSRDivideByZeroFlagMask |
113 kFCSRInvalidOpFlagMask; 113 kFCSRInvalidOpFlagMask;
114 114
115 static const uint32_t kFCSRExceptionFlagMask = 115 const uint32_t kFCSRExceptionFlagMask = kFCSRFlagMask ^ kFCSRInexactFlagMask;
116 kFCSRFlagMask ^ kFCSRInexactFlagMask;
117 116
118 // Helper functions for converting between register numbers and names. 117 // Helper functions for converting between register numbers and names.
119 class Registers { 118 class Registers {
120 public: 119 public:
121 // Return the name of the register. 120 // Return the name of the register.
122 static const char* Name(int reg); 121 static const char* Name(int reg);
123 122
124 // Lookup the register number for the name provided. 123 // Lookup the register number for the name provided.
125 static int Number(const char* name); 124 static int Number(const char* name);
126 125
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 call_rt_redirected = 0xfffff 169 call_rt_redirected = 0xfffff
171 }; 170 };
172 171
173 // On MIPS Simulator breakpoints can have different codes: 172 // On MIPS Simulator breakpoints can have different codes:
174 // - Breaks between 0 and kMaxWatchpointCode are treated as simple watchpoints, 173 // - Breaks between 0 and kMaxWatchpointCode are treated as simple watchpoints,
175 // the simulator will run through them and print the registers. 174 // the simulator will run through them and print the registers.
176 // - Breaks between kMaxWatchpointCode and kMaxStopCode are treated as stop() 175 // - Breaks between kMaxWatchpointCode and kMaxStopCode are treated as stop()
177 // instructions (see Assembler::stop()). 176 // instructions (see Assembler::stop()).
178 // - Breaks larger than kMaxStopCode are simple breaks, dropping you into the 177 // - Breaks larger than kMaxStopCode are simple breaks, dropping you into the
179 // debugger. 178 // debugger.
180 static const uint32_t kMaxWatchpointCode = 31; 179 const uint32_t kMaxWatchpointCode = 31;
181 static const uint32_t kMaxStopCode = 127; 180 const uint32_t kMaxStopCode = 127;
182 STATIC_ASSERT(kMaxWatchpointCode < kMaxStopCode); 181 STATIC_ASSERT(kMaxWatchpointCode < kMaxStopCode);
183 182
184 183
185 // ----- Fields offset and length. 184 // ----- Fields offset and length.
186 static const int kOpcodeShift = 26; 185 const int kOpcodeShift = 26;
187 static const int kOpcodeBits = 6; 186 const int kOpcodeBits = 6;
188 static const int kRsShift = 21; 187 const int kRsShift = 21;
189 static const int kRsBits = 5; 188 const int kRsBits = 5;
190 static const int kRtShift = 16; 189 const int kRtShift = 16;
191 static const int kRtBits = 5; 190 const int kRtBits = 5;
192 static const int kRdShift = 11; 191 const int kRdShift = 11;
193 static const int kRdBits = 5; 192 const int kRdBits = 5;
194 static const int kSaShift = 6; 193 const int kSaShift = 6;
195 static const int kSaBits = 5; 194 const int kSaBits = 5;
196 static const int kFunctionShift = 0; 195 const int kFunctionShift = 0;
197 static const int kFunctionBits = 6; 196 const int kFunctionBits = 6;
198 static const int kLuiShift = 16; 197 const int kLuiShift = 16;
199 198
200 static const int kImm16Shift = 0; 199 const int kImm16Shift = 0;
201 static const int kImm16Bits = 16; 200 const int kImm16Bits = 16;
202 static const int kImm26Shift = 0; 201 const int kImm26Shift = 0;
203 static const int kImm26Bits = 26; 202 const int kImm26Bits = 26;
204 static const int kImm28Shift = 0; 203 const int kImm28Shift = 0;
205 static const int kImm28Bits = 28; 204 const int kImm28Bits = 28;
206 205
207 // In branches and jumps immediate fields point to words, not bytes, 206 // In branches and jumps immediate fields point to words, not bytes,
208 // and are therefore shifted by 2. 207 // and are therefore shifted by 2.
209 static const int kImmFieldShift = 2; 208 const int kImmFieldShift = 2;
210 209
211 static const int kFsShift = 11; 210 const int kFsShift = 11;
212 static const int kFsBits = 5; 211 const int kFsBits = 5;
213 static const int kFtShift = 16; 212 const int kFtShift = 16;
214 static const int kFtBits = 5; 213 const int kFtBits = 5;
215 static const int kFdShift = 6; 214 const int kFdShift = 6;
216 static const int kFdBits = 5; 215 const int kFdBits = 5;
217 static const int kFCccShift = 8; 216 const int kFCccShift = 8;
218 static const int kFCccBits = 3; 217 const int kFCccBits = 3;
219 static const int kFBccShift = 18; 218 const int kFBccShift = 18;
220 static const int kFBccBits = 3; 219 const int kFBccBits = 3;
221 static const int kFBtrueShift = 16; 220 const int kFBtrueShift = 16;
222 static const int kFBtrueBits = 1; 221 const int kFBtrueBits = 1;
223 222
224 // ----- Miscellaneous useful masks. 223 // ----- Miscellaneous useful masks.
225 // Instruction bit masks. 224 // Instruction bit masks.
226 static const int kOpcodeMask = ((1 << kOpcodeBits) - 1) << kOpcodeShift; 225 const int kOpcodeMask = ((1 << kOpcodeBits) - 1) << kOpcodeShift;
227 static const int kImm16Mask = ((1 << kImm16Bits) - 1) << kImm16Shift; 226 const int kImm16Mask = ((1 << kImm16Bits) - 1) << kImm16Shift;
228 static const int kImm26Mask = ((1 << kImm26Bits) - 1) << kImm26Shift; 227 const int kImm26Mask = ((1 << kImm26Bits) - 1) << kImm26Shift;
229 static const int kImm28Mask = ((1 << kImm28Bits) - 1) << kImm28Shift; 228 const int kImm28Mask = ((1 << kImm28Bits) - 1) << kImm28Shift;
230 static const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift; 229 const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift;
231 static const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift; 230 const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift;
232 static const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift; 231 const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift;
233 static const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift; 232 const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift;
234 static const int kFunctionFieldMask = 233 const int kFunctionFieldMask = ((1 << kFunctionBits) - 1) << kFunctionShift;
235 ((1 << kFunctionBits) - 1) << kFunctionShift;
236 // Misc masks. 234 // Misc masks.
237 static const int kHiMask = 0xffff << 16; 235 const int kHiMask = 0xffff << 16;
238 static const int kLoMask = 0xffff; 236 const int kLoMask = 0xffff;
239 static const int kSignMask = 0x80000000; 237 const int kSignMask = 0x80000000;
240 static const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1; 238 const int kJumpAddrMask = (1 << (kImm26Bits + kImmFieldShift)) - 1;
241 239
242 // ----- MIPS Opcodes and Function Fields. 240 // ----- MIPS Opcodes and Function Fields.
243 // We use this presentation to stay close to the table representation in 241 // We use this presentation to stay close to the table representation in
244 // MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set. 242 // MIPS32 Architecture For Programmers, Volume II: The MIPS32 Instruction Set.
245 enum Opcode { 243 enum Opcode {
246 SPECIAL = 0 << kOpcodeShift, 244 SPECIAL = 0 << kOpcodeShift,
247 REGIMM = 1 << kOpcodeShift, 245 REGIMM = 1 << kOpcodeShift,
248 246
249 J = ((0 << 3) + 2) << kOpcodeShift, 247 J = ((0 << 3) + 2) << kOpcodeShift,
250 JAL = ((0 << 3) + 3) << kOpcodeShift, 248 JAL = ((0 << 3) + 3) << kOpcodeShift,
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 RP = 2 << 0, // Round towards Plus Infinity. 520 RP = 2 << 0, // Round towards Plus Infinity.
523 RM = 3 << 0, // Round towards Minus Infinity. 521 RM = 3 << 0, // Round towards Minus Infinity.
524 522
525 // Aliases. 523 // Aliases.
526 kRoundToNearest = RN, 524 kRoundToNearest = RN,
527 kRoundToZero = RZ, 525 kRoundToZero = RZ,
528 kRoundToPlusInf = RP, 526 kRoundToPlusInf = RP,
529 kRoundToMinusInf = RM 527 kRoundToMinusInf = RM
530 }; 528 };
531 529
532 static const uint32_t kFPURoundingModeMask = 3 << 0; 530 const uint32_t kFPURoundingModeMask = 3 << 0;
533 531
534 enum CheckForInexactConversion { 532 enum CheckForInexactConversion {
535 kCheckForInexactConversion, 533 kCheckForInexactConversion,
536 kDontCheckForInexactConversion 534 kDontCheckForInexactConversion
537 }; 535 };
538 536
539 537
540 // ----------------------------------------------------------------------------- 538 // -----------------------------------------------------------------------------
541 // Hints. 539 // Hints.
542 540
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 private: 763 private:
766 // We need to prevent the creation of instances of class Instruction. 764 // We need to prevent the creation of instances of class Instruction.
767 DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction); 765 DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction);
768 }; 766 };
769 767
770 768
771 // ----------------------------------------------------------------------------- 769 // -----------------------------------------------------------------------------
772 // MIPS assembly various constants. 770 // MIPS assembly various constants.
773 771
774 // C/C++ argument slots size. 772 // C/C++ argument slots size.
775 static const int kCArgSlotCount = 4; 773 const int kCArgSlotCount = 4;
776 static const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize; 774 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize;
777 // JS argument slots size. 775 // JS argument slots size.
778 static const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize; 776 const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize;
779 // Assembly builtins argument slots size. 777 // Assembly builtins argument slots size.
780 static const int kBArgsSlotsSize = 0 * Instruction::kInstrSize; 778 const int kBArgsSlotsSize = 0 * Instruction::kInstrSize;
781 779
782 static const int kBranchReturnOffset = 2 * Instruction::kInstrSize; 780 const int kBranchReturnOffset = 2 * Instruction::kInstrSize;
783 781
784 static const int kDoubleAlignmentBits = 3; 782 const int kDoubleAlignmentBits = 3;
785 static const int kDoubleAlignment = (1 << kDoubleAlignmentBits); 783 const int kDoubleAlignment = (1 << kDoubleAlignmentBits);
786 static const int kDoubleAlignmentMask = kDoubleAlignment - 1; 784 const int kDoubleAlignmentMask = kDoubleAlignment - 1;
787 785
788 786
789 } } // namespace v8::internal 787 } } // namespace v8::internal
790 788
791 #endif // #ifndef V8_MIPS_CONSTANTS_H_ 789 #endif // #ifndef V8_MIPS_CONSTANTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698