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_CONSTANTS_H_ | 5 #ifndef V8_MIPS_CONSTANTS_H_ |
6 #define V8_MIPS_CONSTANTS_H_ | 6 #define V8_MIPS_CONSTANTS_H_ |
7 | 7 |
8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
9 #include "src/base/macros.h" | 9 #include "src/base/macros.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 enum Endianness { kLittle, kBig }; | 38 enum Endianness { kLittle, kBig }; |
39 | 39 |
40 #if defined(V8_TARGET_LITTLE_ENDIAN) | 40 #if defined(V8_TARGET_LITTLE_ENDIAN) |
41 static const Endianness kArchEndian = kLittle; | 41 static const Endianness kArchEndian = kLittle; |
42 #elif defined(V8_TARGET_BIG_ENDIAN) | 42 #elif defined(V8_TARGET_BIG_ENDIAN) |
43 static const Endianness kArchEndian = kBig; | 43 static const Endianness kArchEndian = kBig; |
44 #else | 44 #else |
45 #error Unknown endianness | 45 #error Unknown endianness |
46 #endif | 46 #endif |
47 | 47 |
48 // TODO(plind): consider deriving ABI from compiler flags or build system. | |
49 | |
50 // ABI-dependent definitions are made with #define in simulator-mips64.h, | |
51 // so the ABI choice must be available to the pre-processor. However, in all | |
52 // other cases, we should use the enum AbiVariants with normal if statements. | |
53 | |
54 #define MIPS_ABI_N64 1 | |
55 // #define MIPS_ABI_O32 1 | |
56 | |
57 // The only supported Abi's are O32, and n64. | |
58 enum AbiVariants { | |
59 kO32, | |
60 kN64 // Use upper case N for 'n64' ABI to conform to style standard. | |
61 }; | |
62 | |
63 #ifdef MIPS_ABI_N64 | |
64 static const AbiVariants kMipsAbi = kN64; | |
65 #else | |
66 static const AbiVariants kMipsAbi = kO32; | |
67 #endif | |
68 | |
69 | 48 |
70 // TODO(plind): consider renaming these ... | 49 // TODO(plind): consider renaming these ... |
71 #if(defined(__mips_hard_float) && __mips_hard_float != 0) | 50 #if(defined(__mips_hard_float) && __mips_hard_float != 0) |
72 // Use floating-point coprocessor instructions. This flag is raised when | 51 // Use floating-point coprocessor instructions. This flag is raised when |
73 // -mhard-float is passed to the compiler. | 52 // -mhard-float is passed to the compiler. |
74 const bool IsMipsSoftFloatABI = false; | 53 const bool IsMipsSoftFloatABI = false; |
75 #elif(defined(__mips_soft_float) && __mips_soft_float != 0) | 54 #elif(defined(__mips_soft_float) && __mips_soft_float != 0) |
76 // This flag is raised when -msoft-float is passed to the compiler. | 55 // This flag is raised when -msoft-float is passed to the compiler. |
77 // Although FPU is a base requirement for v8, soft-float ABI is used | 56 // Although FPU is a base requirement for v8, soft-float ABI is used |
78 // on soft-float systems with FPU kernel emulation. | 57 // on soft-float systems with FPU kernel emulation. |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 private: | 1156 private: |
1178 // We need to prevent the creation of instances of class Instruction. | 1157 // We need to prevent the creation of instances of class Instruction. |
1179 DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction); | 1158 DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction); |
1180 }; | 1159 }; |
1181 | 1160 |
1182 | 1161 |
1183 // ----------------------------------------------------------------------------- | 1162 // ----------------------------------------------------------------------------- |
1184 // MIPS assembly various constants. | 1163 // MIPS assembly various constants. |
1185 | 1164 |
1186 // C/C++ argument slots size. | 1165 // C/C++ argument slots size. |
1187 const int kCArgSlotCount = (kMipsAbi == kN64) ? 0 : 4; | 1166 const int kCArgSlotCount = 0; |
1188 | 1167 |
1189 // TODO(plind): below should be based on kPointerSize | 1168 // TODO(plind): below should be based on kPointerSize |
1190 // TODO(plind): find all usages and remove the needless instructions for n64. | 1169 // TODO(plind): find all usages and remove the needless instructions for n64. |
1191 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize * 2; | 1170 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize * 2; |
1192 | 1171 |
1193 const int kInvalidStackOffset = -1; | 1172 const int kInvalidStackOffset = -1; |
1194 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 1173 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
1195 | 1174 |
1196 | 1175 |
1197 Instruction::Type Instruction::InstructionType(TypeChecks checks) const { | 1176 Instruction::Type Instruction::InstructionType(TypeChecks checks) const { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 } | 1277 } |
1299 return kUnsupported; | 1278 return kUnsupported; |
1300 } | 1279 } |
1301 | 1280 |
1302 #undef OpcodeToBitNumber | 1281 #undef OpcodeToBitNumber |
1303 #undef FunctionFieldToBitNumber | 1282 #undef FunctionFieldToBitNumber |
1304 } // namespace internal | 1283 } // namespace internal |
1305 } // namespace v8 | 1284 } // namespace v8 |
1306 | 1285 |
1307 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 1286 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
OLD | NEW |