| 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_ASSEMBLER_IA32_H_ | 5 #ifndef VM_ASSEMBLER_IA32_H_ |
| 6 #define VM_ASSEMBLER_IA32_H_ | 6 #define VM_ASSEMBLER_IA32_H_ |
| 7 | 7 |
| 8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
| 9 #error Do not include assembler_ia32.h directly; use assembler.h instead. | 9 #error Do not include assembler_ia32.h directly; use assembler.h instead. |
| 10 #endif | 10 #endif |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 Address(Register index, ScaleFactor scale, int32_t disp) { | 161 Address(Register index, ScaleFactor scale, int32_t disp) { |
| 162 ASSERT(index != ESP); // Illegal addressing mode. | 162 ASSERT(index != ESP); // Illegal addressing mode. |
| 163 SetModRM(0, ESP); | 163 SetModRM(0, ESP); |
| 164 SetSIB(scale, index, EBP); | 164 SetSIB(scale, index, EBP); |
| 165 SetDisp32(disp); | 165 SetDisp32(disp); |
| 166 } | 166 } |
| 167 | 167 |
| 168 Address(Register index, ScaleFactor scale, Register r) { |
| 169 UNREACHABLE(); |
| 170 } |
| 171 |
| 168 Address(Register base, Register index, ScaleFactor scale, int32_t disp) { | 172 Address(Register base, Register index, ScaleFactor scale, int32_t disp) { |
| 169 ASSERT(index != ESP); // Illegal addressing mode. | 173 ASSERT(index != ESP); // Illegal addressing mode. |
| 170 if (disp == 0 && base != EBP) { | 174 if (disp == 0 && base != EBP) { |
| 171 SetModRM(0, ESP); | 175 SetModRM(0, ESP); |
| 172 SetSIB(scale, index, base); | 176 SetSIB(scale, index, base); |
| 173 } else if (Utils::IsInt(8, disp)) { | 177 } else if (Utils::IsInt(8, disp)) { |
| 174 SetModRM(1, ESP); | 178 SetModRM(1, ESP); |
| 175 SetSIB(scale, index, base); | 179 SetSIB(scale, index, base); |
| 176 SetDisp8(disp); | 180 SetDisp8(disp); |
| 177 } else { | 181 } else { |
| 178 SetModRM(2, ESP); | 182 SetModRM(2, ESP); |
| 179 SetSIB(scale, index, base); | 183 SetSIB(scale, index, base); |
| 180 SetDisp32(disp); | 184 SetDisp32(disp); |
| 181 } | 185 } |
| 182 } | 186 } |
| 183 | 187 |
| 188 Address(Register base, Register index, ScaleFactor scale, Register r) { |
| 189 UNREACHABLE(); |
| 190 } |
| 191 |
| 184 Address(const Address& other) : Operand(other) { } | 192 Address(const Address& other) : Operand(other) { } |
| 185 | 193 |
| 186 Address& operator=(const Address& other) { | 194 Address& operator=(const Address& other) { |
| 187 Operand::operator=(other); | 195 Operand::operator=(other); |
| 188 return *this; | 196 return *this; |
| 189 } | 197 } |
| 190 | 198 |
| 191 static Address Absolute(const uword addr) { | 199 static Address Absolute(const uword addr) { |
| 192 Address result; | 200 Address result; |
| 193 result.SetModRM(0, EBP); | 201 result.SetModRM(0, EBP); |
| 194 result.SetDisp32(addr); | 202 result.SetDisp32(addr); |
| 195 return result; | 203 return result; |
| 196 } | 204 } |
| 197 | 205 |
| 198 private: | 206 private: |
| 199 Address() { } // Needed by Address::Absolute. | 207 Address() { } // Needed by Address::Absolute. |
| 200 }; | 208 }; |
| 201 | 209 |
| 202 | 210 |
| 203 class FieldAddress : public Address { | 211 class FieldAddress : public Address { |
| 204 public: | 212 public: |
| 205 FieldAddress(Register base, int32_t disp) | 213 FieldAddress(Register base, int32_t disp) |
| 206 : Address(base, disp - kHeapObjectTag) { } | 214 : Address(base, disp - kHeapObjectTag) { } |
| 207 | 215 |
| 216 FieldAddress(Register base, Register r) : Address(base, 0) { |
| 217 UNREACHABLE(); |
| 218 } |
| 219 |
| 208 FieldAddress(Register base, Register index, ScaleFactor scale, int32_t disp) | 220 FieldAddress(Register base, Register index, ScaleFactor scale, int32_t disp) |
| 209 : Address(base, index, scale, disp - kHeapObjectTag) { } | 221 : Address(base, index, scale, disp - kHeapObjectTag) { } |
| 210 | 222 |
| 223 FieldAddress(Register base, Register index, ScaleFactor scale, Register r) |
| 224 : Address(base, index, scale, 0) { |
| 225 UNREACHABLE(); |
| 226 } |
| 227 |
| 211 FieldAddress(const FieldAddress& other) : Address(other) { } | 228 FieldAddress(const FieldAddress& other) : Address(other) { } |
| 212 | 229 |
| 213 FieldAddress& operator=(const FieldAddress& other) { | 230 FieldAddress& operator=(const FieldAddress& other) { |
| 214 Address::operator=(other); | 231 Address::operator=(other); |
| 215 return *this; | 232 return *this; |
| 216 } | 233 } |
| 217 }; | 234 }; |
| 218 | 235 |
| 219 | 236 |
| 220 class Label : public ValueObject { | 237 class Label : public ValueObject { |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 } | 963 } |
| 947 | 964 |
| 948 | 965 |
| 949 inline void Assembler::EmitOperandSizeOverride() { | 966 inline void Assembler::EmitOperandSizeOverride() { |
| 950 EmitUint8(0x66); | 967 EmitUint8(0x66); |
| 951 } | 968 } |
| 952 | 969 |
| 953 } // namespace dart | 970 } // namespace dart |
| 954 | 971 |
| 955 #endif // VM_ASSEMBLER_IA32_H_ | 972 #endif // VM_ASSEMBLER_IA32_H_ |
| OLD | NEW |