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_X64_H_ | 5 #ifndef VM_CONSTANTS_X64_H_ |
6 #define VM_CONSTANTS_X64_H_ | 6 #define VM_CONSTANTS_X64_H_ |
7 | 7 |
8 namespace dart { | 8 namespace dart { |
9 | 9 |
10 enum Register { | 10 enum Register { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 GREATER = 15, | 131 GREATER = 15, |
132 | 132 |
133 ZERO = EQUAL, | 133 ZERO = EQUAL, |
134 NOT_ZERO = NOT_EQUAL, | 134 NOT_ZERO = NOT_EQUAL, |
135 NEGATIVE = SIGN, | 135 NEGATIVE = SIGN, |
136 POSITIVE = NOT_SIGN, | 136 POSITIVE = NOT_SIGN, |
137 CARRY = BELOW, | 137 CARRY = BELOW, |
138 NOT_CARRY = ABOVE_EQUAL | 138 NOT_CARRY = ABOVE_EQUAL |
139 }; | 139 }; |
140 | 140 |
| 141 #define R(reg) (1 << (reg)) |
| 142 |
| 143 #if defined(_WIN64) |
| 144 class CallingConventions { |
| 145 public: |
| 146 static const Register kArg1Reg = RCX; |
| 147 static const Register kArg2Reg = RDX; |
| 148 static const Register kArg3Reg = R8; |
| 149 static const Register kArg4Reg = R9; |
| 150 static const intptr_t kShadowSpaceBytes = 4 * kWordSize; |
| 151 |
| 152 static const intptr_t kVolatileCpuRegisters = |
| 153 R(RAX) | R(RCX) | R(RDX) | R(R8) | R(R9) | R(R10) | R(R11); |
| 154 |
| 155 static const intptr_t kVolatileXmmRegisters = |
| 156 R(XMM0) | R(XMM1) | R(XMM2) | R(XMM3) | R(XMM4) | R(XMM5); |
| 157 |
| 158 static const intptr_t kCalleeSaveCpuRegisters = |
| 159 R(RBX) | R(RSI) | R(RDI) | R(R12) | R(R13) | R(R14) | R(R15); |
| 160 |
| 161 static const intptr_t kCalleeSaveXmmRegisters = |
| 162 R(XMM6) | R(XMM7) | R(XMM8) | R(XMM9) | R(XMM10) | R(XMM11) | R(XMM12) | |
| 163 R(XMM13) | R(XMM14) | R(XMM15); |
| 164 |
| 165 // Windows x64 ABI specifies that small objects are passed in registers. |
| 166 // Otherwise they are passed by reference. |
| 167 static const size_t kRegisterTransferLimit = 16; |
| 168 }; |
| 169 #else |
| 170 class CallingConventions { |
| 171 public: |
| 172 static const Register kArg1Reg = RDI; |
| 173 static const Register kArg2Reg = RSI; |
| 174 static const Register kArg3Reg = RDX; |
| 175 static const Register kArg4Reg = RCX; |
| 176 static const Register kArg5Reg = R8; |
| 177 static const Register kArg6Reg = R9; |
| 178 static const intptr_t kShadowSpaceBytes = 0; |
| 179 |
| 180 static const intptr_t kVolatileCpuRegisters = |
| 181 R(RAX) | R(RCX) | R(RDX) | R(RSI) | R(RDI) | |
| 182 R(R8) | R(R9) | R(R10) | R(R11); |
| 183 |
| 184 static const intptr_t kVolatileXmmRegisters = |
| 185 R(XMM0) | R(XMM1) | R(XMM2) | R(XMM3) | R(XMM4) | |
| 186 R(XMM5) | R(XMM6) | R(XMM7) | R(XMM8) | R(XMM9) | |
| 187 R(XMM10) | R(XMM11) | R(XMM12) | R(XMM13) | R(XMM14) | R(XMM15); |
| 188 |
| 189 static const intptr_t kCalleeSaveCpuRegisters = |
| 190 R(RBX) | R(R12) | R(R13) | R(R14) | R(R15); |
| 191 |
| 192 static const intptr_t kCalleeSaveXmmRegisters = 0; |
| 193 }; |
| 194 #endif |
| 195 |
| 196 #undef R |
141 | 197 |
142 class Instr { | 198 class Instr { |
143 public: | 199 public: |
144 static const uint8_t kHltInstruction = 0xF4; | 200 static const uint8_t kHltInstruction = 0xF4; |
145 // We prefer not to use the int3 instruction since it conflicts with gdb. | 201 // We prefer not to use the int3 instruction since it conflicts with gdb. |
146 static const uint8_t kBreakPointInstruction = kHltInstruction; | 202 static const uint8_t kBreakPointInstruction = kHltInstruction; |
147 static const int kBreakPointInstructionSize = 1; | 203 static const int kBreakPointInstructionSize = 1; |
148 | 204 |
149 bool IsBreakPoint() { | 205 bool IsBreakPoint() { |
150 ASSERT(kBreakPointInstructionSize == 1); | 206 ASSERT(kBreakPointInstructionSize == 1); |
(...skipping 13 matching lines...) Expand all Loading... |
164 }; | 220 }; |
165 | 221 |
166 | 222 |
167 // The largest multibyte nop we will emit. This could go up to 15 if it | 223 // The largest multibyte nop we will emit. This could go up to 15 if it |
168 // becomes important to us. | 224 // becomes important to us. |
169 const int MAX_NOP_SIZE = 8; | 225 const int MAX_NOP_SIZE = 8; |
170 | 226 |
171 } // namespace dart | 227 } // namespace dart |
172 | 228 |
173 #endif // VM_CONSTANTS_X64_H_ | 229 #endif // VM_CONSTANTS_X64_H_ |
OLD | NEW |