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 RUNTIME_VM_CONSTANTS_IA32_H_ | 5 #ifndef RUNTIME_VM_CONSTANTS_IA32_H_ |
6 #define RUNTIME_VM_CONSTANTS_IA32_H_ | 6 #define RUNTIME_VM_CONSTANTS_IA32_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 | 52 |
53 // Architecture independent aliases. | 53 // Architecture independent aliases. |
54 typedef XmmRegister FpuRegister; | 54 typedef XmmRegister FpuRegister; |
55 const FpuRegister FpuTMP = XMM0; | 55 const FpuRegister FpuTMP = XMM0; |
56 const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; | 56 const int kNumberOfFpuRegisters = kNumberOfXmmRegisters; |
57 const FpuRegister kNoFpuRegister = kNoXmmRegister; | 57 const FpuRegister kNoFpuRegister = kNoXmmRegister; |
58 | 58 |
59 | 59 |
60 // Register aliases. | 60 // Register aliases. |
61 const Register TMP = kNoRegister; // No scratch register used by assembler. | 61 const Register TMP = kNoRegister; // No scratch register used by assembler. |
62 const Register TMP2 = kNoRegister; // No second assembler scratch register. | 62 const Register TMP2 = kNoRegister; // No second assembler scratch register. |
63 const Register CTX = EDI; // Location of current context at method entry. | 63 const Register CTX = EDI; // Location of current context at method entry. |
64 const Register CODE_REG = EDI; | 64 const Register CODE_REG = EDI; |
65 const Register PP = kNoRegister; // No object pool pointer. | 65 const Register PP = kNoRegister; // No object pool pointer. |
66 const Register SPREG = ESP; // Stack pointer register. | 66 const Register SPREG = ESP; // Stack pointer register. |
67 const Register FPREG = EBP; // Frame pointer register. | 67 const Register FPREG = EBP; // Frame pointer register. |
68 const Register ICREG = ECX; // IC data register. | 68 const Register ICREG = ECX; // IC data register. |
69 const Register ARGS_DESC_REG = EDX; // Arguments descriptor register. | 69 const Register ARGS_DESC_REG = EDX; // Arguments descriptor register. |
70 const Register THR = ESI; // Caches current thread in generated code. | 70 const Register THR = ESI; // Caches current thread in generated code. |
71 const Register CALLEE_SAVED_TEMP = EBX; | 71 const Register CALLEE_SAVED_TEMP = EBX; |
72 const Register CALLEE_SAVED_TEMP2 = EDI; | 72 const Register CALLEE_SAVED_TEMP2 = EDI; |
73 | 73 |
74 // Exception object is passed in this register to the catch handlers when an | 74 // Exception object is passed in this register to the catch handlers when an |
75 // exception is thrown. | 75 // exception is thrown. |
76 const Register kExceptionObjectReg = EAX; | 76 const Register kExceptionObjectReg = EAX; |
77 | 77 |
78 // Stack trace object is passed in this register to the catch handlers when | 78 // Stack trace object is passed in this register to the catch handlers when |
79 // an exception is thrown. | 79 // an exception is thrown. |
80 const Register kStackTraceObjectReg = EDX; | 80 const Register kStackTraceObjectReg = EDX; |
81 | 81 |
82 | 82 |
83 typedef uint32_t RegList; | 83 typedef uint32_t RegList; |
84 const RegList kAllCpuRegistersList = 0xFF; | 84 const RegList kAllCpuRegistersList = 0xFF; |
85 | 85 |
86 const intptr_t kReservedCpuRegisters = | 86 const intptr_t kReservedCpuRegisters = (1 << SPREG) | (1 << FPREG) | (1 << THR); |
87 (1 << SPREG) | | |
88 (1 << FPREG) | | |
89 (1 << THR); | |
90 // CPU registers available to Dart allocator. | 87 // CPU registers available to Dart allocator. |
91 const RegList kDartAvailableCpuRegs = | 88 const RegList kDartAvailableCpuRegs = |
92 kAllCpuRegistersList & ~kReservedCpuRegisters; | 89 kAllCpuRegistersList & ~kReservedCpuRegisters; |
93 | 90 |
94 | 91 |
95 enum ScaleFactor { | 92 enum ScaleFactor { |
96 TIMES_1 = 0, | 93 TIMES_1 = 0, |
97 TIMES_2 = 1, | 94 TIMES_2 = 1, |
98 TIMES_4 = 2, | 95 TIMES_4 = 2, |
99 TIMES_8 = 3, | 96 TIMES_8 = 3, |
100 TIMES_16 = 4, | 97 TIMES_16 = 4, |
101 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 | 98 TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1 |
102 }; | 99 }; |
103 | 100 |
104 | 101 |
105 enum Condition { | 102 enum Condition { |
106 OVERFLOW = 0, | 103 OVERFLOW = 0, |
107 NO_OVERFLOW = 1, | 104 NO_OVERFLOW = 1, |
108 BELOW = 2, | 105 BELOW = 2, |
109 ABOVE_EQUAL = 3, | 106 ABOVE_EQUAL = 3, |
110 EQUAL = 4, | 107 EQUAL = 4, |
111 NOT_EQUAL = 5, | 108 NOT_EQUAL = 5, |
112 BELOW_EQUAL = 6, | 109 BELOW_EQUAL = 6, |
113 ABOVE = 7, | 110 ABOVE = 7, |
114 SIGN = 8, | 111 SIGN = 8, |
115 NOT_SIGN = 9, | 112 NOT_SIGN = 9, |
116 PARITY_EVEN = 10, | 113 PARITY_EVEN = 10, |
117 PARITY_ODD = 11, | 114 PARITY_ODD = 11, |
118 LESS = 12, | 115 LESS = 12, |
119 GREATER_EQUAL = 13, | 116 GREATER_EQUAL = 13, |
120 LESS_EQUAL = 14, | 117 LESS_EQUAL = 14, |
121 GREATER = 15, | 118 GREATER = 15, |
122 | 119 |
123 ZERO = EQUAL, | 120 ZERO = EQUAL, |
124 NOT_ZERO = NOT_EQUAL, | 121 NOT_ZERO = NOT_EQUAL, |
125 NEGATIVE = SIGN, | 122 NEGATIVE = SIGN, |
126 POSITIVE = NOT_SIGN, | 123 POSITIVE = NOT_SIGN, |
127 CARRY = BELOW, | 124 CARRY = BELOW, |
128 NOT_CARRY = ABOVE_EQUAL | 125 NOT_CARRY = ABOVE_EQUAL |
129 }; | 126 }; |
130 | 127 |
131 | 128 |
132 class Instr { | 129 class Instr { |
133 public: | 130 public: |
134 static const uint8_t kHltInstruction = 0xF4; | 131 static const uint8_t kHltInstruction = 0xF4; |
135 // We prefer not to use the int3 instruction since it conflicts with gdb. | 132 // We prefer not to use the int3 instruction since it conflicts with gdb. |
136 static const uint8_t kBreakPointInstruction = kHltInstruction; | 133 static const uint8_t kBreakPointInstruction = kHltInstruction; |
137 static const int kBreakPointInstructionSize = 1; | 134 static const int kBreakPointInstructionSize = 1; |
138 | 135 |
(...skipping 15 matching lines...) Expand all Loading... |
154 }; | 151 }; |
155 | 152 |
156 | 153 |
157 // The largest multibyte nop we will emit. This could go up to 15 if it | 154 // The largest multibyte nop we will emit. This could go up to 15 if it |
158 // becomes important to us. | 155 // becomes important to us. |
159 const int MAX_NOP_SIZE = 8; | 156 const int MAX_NOP_SIZE = 8; |
160 | 157 |
161 } // namespace dart | 158 } // namespace dart |
162 | 159 |
163 #endif // RUNTIME_VM_CONSTANTS_IA32_H_ | 160 #endif // RUNTIME_VM_CONSTANTS_IA32_H_ |
OLD | NEW |