OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_CONSTANTS_IA32_H_ | 5 #ifndef VM_CONSTANTS_IA32_H_ |
6 #define VM_CONSTANTS_IA32_H_ | 6 #define VM_CONSTANTS_IA32_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
11 | 11 |
12 enum Register { | 12 enum Register { |
13 kFirstFreeCpuRegister = 0, | |
14 EAX = 0, | 13 EAX = 0, |
15 ECX = 1, | 14 ECX = 1, |
16 EDX = 2, | 15 EDX = 2, |
17 EBX = 3, | 16 EBX = 3, |
18 ESP = 4, | 17 ESP = 4, |
19 EBP = 5, | 18 EBP = 5, |
20 ESI = 6, | 19 ESI = 6, |
21 EDI = 7, | 20 EDI = 7, |
22 kLastFreeCpuRegister = 7, | |
23 kNumberOfCpuRegisters = 8, | 21 kNumberOfCpuRegisters = 8, |
24 kNoRegister = -1 // Signals an illegal register. | 22 kNoRegister = -1, // Signals an illegal register. |
25 }; | 23 }; |
26 | 24 |
27 | 25 |
28 enum ByteRegister { | 26 enum ByteRegister { |
29 AL = 0, | 27 AL = 0, |
30 CL = 1, | 28 CL = 1, |
31 DL = 2, | 29 DL = 2, |
32 BL = 3, | 30 BL = 3, |
33 AH = 4, | 31 AH = 4, |
34 CH = 5, | 32 CH = 5, |
(...skipping 29 matching lines...) Expand all Loading... |
64 const Register TMP2 = kNoRegister; // No second assembler scratch register. | 62 const Register TMP2 = kNoRegister; // No second assembler scratch register. |
65 const Register CTX = EDI; // Location of current context at method entry. | 63 const Register CTX = EDI; // Location of current context at method entry. |
66 const Register CODE_REG = EDI; | 64 const Register CODE_REG = EDI; |
67 const Register PP = kNoRegister; // No object pool pointer. | 65 const Register PP = kNoRegister; // No object pool pointer. |
68 const Register SPREG = ESP; // Stack pointer register. | 66 const Register SPREG = ESP; // Stack pointer register. |
69 const Register FPREG = EBP; // Frame pointer register. | 67 const Register FPREG = EBP; // Frame pointer register. |
70 const Register ICREG = ECX; // IC data register. | 68 const Register ICREG = ECX; // IC data register. |
71 const Register ARGS_DESC_REG = EDX; // Arguments descriptor register. | 69 const Register ARGS_DESC_REG = EDX; // Arguments descriptor register. |
72 const Register THR = ESI; // Caches current thread in generated code. | 70 const Register THR = ESI; // Caches current thread in generated code. |
73 | 71 |
| 72 |
74 // Exception object is passed in this register to the catch handlers when an | 73 // Exception object is passed in this register to the catch handlers when an |
75 // exception is thrown. | 74 // exception is thrown. |
76 const Register kExceptionObjectReg = EAX; | 75 const Register kExceptionObjectReg = EAX; |
77 | 76 |
78 // Stack trace object is passed in this register to the catch handlers when | 77 // Stack trace object is passed in this register to the catch handlers when |
79 // an exception is thrown. | 78 // an exception is thrown. |
80 const Register kStackTraceObjectReg = EDX; | 79 const Register kStackTraceObjectReg = EDX; |
81 | 80 |
82 | 81 |
| 82 typedef uint32_t RegList; |
| 83 const RegList kAllCpuRegistersList = 0xFF; |
| 84 |
| 85 const intptr_t kReservedCpuRegisters = |
| 86 (1 << SPREG) | |
| 87 (1 << FPREG) | |
| 88 (1 << THR); |
| 89 // CPU registers available to Dart allocator. |
| 90 const RegList kDartAvailableCpuRegs = |
| 91 kAllCpuRegistersList & ~kReservedCpuRegisters; |
| 92 |
| 93 |
83 enum ScaleFactor { | 94 enum ScaleFactor { |
84 TIMES_1 = 0, | 95 TIMES_1 = 0, |
85 TIMES_2 = 1, | 96 TIMES_2 = 1, |
86 TIMES_4 = 2, | 97 TIMES_4 = 2, |
87 TIMES_8 = 3, | 98 TIMES_8 = 3, |
88 TIMES_16 = 4, | 99 TIMES_16 = 4, |
89 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 | 100 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 |
90 }; | 101 }; |
91 | 102 |
92 | 103 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 }; | 153 }; |
143 | 154 |
144 | 155 |
145 // The largest multibyte nop we will emit. This could go up to 15 if it | 156 // The largest multibyte nop we will emit. This could go up to 15 if it |
146 // becomes important to us. | 157 // becomes important to us. |
147 const int MAX_NOP_SIZE = 8; | 158 const int MAX_NOP_SIZE = 8; |
148 | 159 |
149 } // namespace dart | 160 } // namespace dart |
150 | 161 |
151 #endif // VM_CONSTANTS_IA32_H_ | 162 #endif // VM_CONSTANTS_IA32_H_ |
OLD | NEW |