| 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 // This addressing mode does not exist. |
| 169 Address(Register index, ScaleFactor scale, Register r); |
| 170 |
| 168 Address(Register base, Register index, ScaleFactor scale, int32_t disp) { | 171 Address(Register base, Register index, ScaleFactor scale, int32_t disp) { |
| 169 ASSERT(index != ESP); // Illegal addressing mode. | 172 ASSERT(index != ESP); // Illegal addressing mode. |
| 170 if (disp == 0 && base != EBP) { | 173 if (disp == 0 && base != EBP) { |
| 171 SetModRM(0, ESP); | 174 SetModRM(0, ESP); |
| 172 SetSIB(scale, index, base); | 175 SetSIB(scale, index, base); |
| 173 } else if (Utils::IsInt(8, disp)) { | 176 } else if (Utils::IsInt(8, disp)) { |
| 174 SetModRM(1, ESP); | 177 SetModRM(1, ESP); |
| 175 SetSIB(scale, index, base); | 178 SetSIB(scale, index, base); |
| 176 SetDisp8(disp); | 179 SetDisp8(disp); |
| 177 } else { | 180 } else { |
| 178 SetModRM(2, ESP); | 181 SetModRM(2, ESP); |
| 179 SetSIB(scale, index, base); | 182 SetSIB(scale, index, base); |
| 180 SetDisp32(disp); | 183 SetDisp32(disp); |
| 181 } | 184 } |
| 182 } | 185 } |
| 183 | 186 |
| 187 // This addressing mode does not exist. |
| 188 Address(Register base, Register index, ScaleFactor scale, Register r); |
| 189 |
| 184 Address(const Address& other) : Operand(other) { } | 190 Address(const Address& other) : Operand(other) { } |
| 185 | 191 |
| 186 Address& operator=(const Address& other) { | 192 Address& operator=(const Address& other) { |
| 187 Operand::operator=(other); | 193 Operand::operator=(other); |
| 188 return *this; | 194 return *this; |
| 189 } | 195 } |
| 190 | 196 |
| 191 static Address Absolute(const uword addr) { | 197 static Address Absolute(const uword addr) { |
| 192 Address result; | 198 Address result; |
| 193 result.SetModRM(0, EBP); | 199 result.SetModRM(0, EBP); |
| 194 result.SetDisp32(addr); | 200 result.SetDisp32(addr); |
| 195 return result; | 201 return result; |
| 196 } | 202 } |
| 197 | 203 |
| 198 private: | 204 private: |
| 199 Address() { } // Needed by Address::Absolute. | 205 Address() { } // Needed by Address::Absolute. |
| 200 }; | 206 }; |
| 201 | 207 |
| 202 | 208 |
| 203 class FieldAddress : public Address { | 209 class FieldAddress : public Address { |
| 204 public: | 210 public: |
| 205 FieldAddress(Register base, int32_t disp) | 211 FieldAddress(Register base, int32_t disp) |
| 206 : Address(base, disp - kHeapObjectTag) { } | 212 : Address(base, disp - kHeapObjectTag) { } |
| 207 | 213 |
| 214 // This addressing mode does not exist. |
| 215 FieldAddress(Register base, Register r); |
| 216 |
| 208 FieldAddress(Register base, Register index, ScaleFactor scale, int32_t disp) | 217 FieldAddress(Register base, Register index, ScaleFactor scale, int32_t disp) |
| 209 : Address(base, index, scale, disp - kHeapObjectTag) { } | 218 : Address(base, index, scale, disp - kHeapObjectTag) { } |
| 210 | 219 |
| 220 // This addressing mode does not exist. |
| 221 FieldAddress(Register base, Register index, ScaleFactor scale, Register r); |
| 222 |
| 211 FieldAddress(const FieldAddress& other) : Address(other) { } | 223 FieldAddress(const FieldAddress& other) : Address(other) { } |
| 212 | 224 |
| 213 FieldAddress& operator=(const FieldAddress& other) { | 225 FieldAddress& operator=(const FieldAddress& other) { |
| 214 Address::operator=(other); | 226 Address::operator=(other); |
| 215 return *this; | 227 return *this; |
| 216 } | 228 } |
| 217 }; | 229 }; |
| 218 | 230 |
| 219 | 231 |
| 220 class Label : public ValueObject { | 232 class Label : public ValueObject { |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 } | 962 } |
| 951 | 963 |
| 952 | 964 |
| 953 inline void Assembler::EmitOperandSizeOverride() { | 965 inline void Assembler::EmitOperandSizeOverride() { |
| 954 EmitUint8(0x66); | 966 EmitUint8(0x66); |
| 955 } | 967 } |
| 956 | 968 |
| 957 } // namespace dart | 969 } // namespace dart |
| 958 | 970 |
| 959 #endif // VM_ASSEMBLER_IA32_H_ | 971 #endif // VM_ASSEMBLER_IA32_H_ |
| OLD | NEW |