Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: runtime/vm/assembler_x64.h

Issue 593363003: Expands the use of Immediate and Operand wrappers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_X64_H_ 5 #ifndef VM_ASSEMBLER_X64_H_
6 #define VM_ASSEMBLER_X64_H_ 6 #define VM_ASSEMBLER_X64_H_
7 7
8 #ifndef VM_ASSEMBLER_H_ 8 #ifndef VM_ASSEMBLER_H_
9 #error Do not include assembler_x64.h directly; use assembler.h instead. 9 #error Do not include assembler_x64.h directly; use assembler.h instead.
10 #endif 10 #endif
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 SetDisp8(disp); 178 SetDisp8(disp);
179 } else { 179 } else {
180 SetModRM(2, base); 180 SetModRM(2, base);
181 if ((base & 7) == RSP) { 181 if ((base & 7) == RSP) {
182 SetSIB(TIMES_1, RSP, base); 182 SetSIB(TIMES_1, RSP, base);
183 } 183 }
184 SetDisp32(disp); 184 SetDisp32(disp);
185 } 185 }
186 } 186 }
187 187
188 Address(Register base, Register r) {
189 UNREACHABLE();
190 }
191
188 Address(Register index, ScaleFactor scale, int32_t disp) { 192 Address(Register index, ScaleFactor scale, int32_t disp) {
189 ASSERT(index != RSP); // Illegal addressing mode. 193 ASSERT(index != RSP); // Illegal addressing mode.
190 SetModRM(0, RSP); 194 SetModRM(0, RSP);
191 SetSIB(scale, index, RBP); 195 SetSIB(scale, index, RBP);
192 SetDisp32(disp); 196 SetDisp32(disp);
193 } 197 }
194 198
199 Address(Register index, ScaleFactor scale, Register r) {
200 UNREACHABLE();
201 }
202
195 Address(Register base, Register index, ScaleFactor scale, int32_t disp) { 203 Address(Register base, Register index, ScaleFactor scale, int32_t disp) {
196 ASSERT(index != RSP); // Illegal addressing mode. 204 ASSERT(index != RSP); // Illegal addressing mode.
197 if ((disp == 0) && ((base & 7) != RBP)) { 205 if ((disp == 0) && ((base & 7) != RBP)) {
198 SetModRM(0, RSP); 206 SetModRM(0, RSP);
199 SetSIB(scale, index, base); 207 SetSIB(scale, index, base);
200 } else if (Utils::IsInt(8, disp)) { 208 } else if (Utils::IsInt(8, disp)) {
201 SetModRM(1, RSP); 209 SetModRM(1, RSP);
202 SetSIB(scale, index, base); 210 SetSIB(scale, index, base);
203 SetDisp8(disp); 211 SetDisp8(disp);
204 } else { 212 } else {
205 SetModRM(2, RSP); 213 SetModRM(2, RSP);
206 SetSIB(scale, index, base); 214 SetSIB(scale, index, base);
207 SetDisp32(disp); 215 SetDisp32(disp);
208 } 216 }
209 } 217 }
210 218
219 Address(Register base, Register index, ScaleFactor scale, Register r) {
220 UNREACHABLE();
221 }
222
211 Address(const Address& other) : Operand(other) { } 223 Address(const Address& other) : Operand(other) { }
212 224
213 Address& operator=(const Address& other) { 225 Address& operator=(const Address& other) {
214 Operand::operator=(other); 226 Operand::operator=(other);
215 return *this; 227 return *this;
216 } 228 }
217 229
218 static Address AddressBaseImm32(Register base, int32_t disp) { 230 static Address AddressBaseImm32(Register base, int32_t disp) {
219 return Address(base, disp, true); 231 return Address(base, disp, true);
220 } 232 }
221 233
234 static Address AddressBaseImm32(Register base, Register r) {
235 UNREACHABLE();
236 return Address(base, 0, true);
237 }
238
222 private: 239 private:
223 Address(Register base, int32_t disp, bool fixed) { 240 Address(Register base, int32_t disp, bool fixed) {
224 ASSERT(fixed); 241 ASSERT(fixed);
225 SetModRM(2, base); 242 SetModRM(2, base);
226 if ((base & 7) == RSP) { 243 if ((base & 7) == RSP) {
227 SetSIB(TIMES_1, RSP, base); 244 SetSIB(TIMES_1, RSP, base);
228 } 245 }
229 SetDisp32(disp); 246 SetDisp32(disp);
230 } 247 }
231 }; 248 };
232 249
233 250
234 class FieldAddress : public Address { 251 class FieldAddress : public Address {
235 public: 252 public:
236 FieldAddress(Register base, int32_t disp) 253 FieldAddress(Register base, int32_t disp)
237 : Address(base, disp - kHeapObjectTag) { } 254 : Address(base, disp - kHeapObjectTag) { }
238 255
256 FieldAddress(Register base, Register r) : Address(base, 0) {
257 UNREACHABLE();
258 }
259
239 FieldAddress(Register base, Register index, ScaleFactor scale, int32_t disp) 260 FieldAddress(Register base, Register index, ScaleFactor scale, int32_t disp)
240 : Address(base, index, scale, disp - kHeapObjectTag) { } 261 : Address(base, index, scale, disp - kHeapObjectTag) { }
241 262
263 FieldAddress(Register base, Register index, ScaleFactor scale, Register r)
264 : Address(base, index, scale, 0) {
265 UNREACHABLE();
266 }
267
242 FieldAddress(const FieldAddress& other) : Address(other) { } 268 FieldAddress(const FieldAddress& other) : Address(other) { }
243 269
244 FieldAddress& operator=(const FieldAddress& other) { 270 FieldAddress& operator=(const FieldAddress& other) {
245 Address::operator=(other); 271 Address::operator=(other);
246 return *this; 272 return *this;
247 } 273 }
248 }; 274 };
249 275
250 276
251 class Label : public ValueObject { 277 class Label : public ValueObject {
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 intptr_t FindObject(const Object& obj, Patchability patchable); 1026 intptr_t FindObject(const Object& obj, Patchability patchable);
1001 intptr_t FindExternalLabel(const ExternalLabel* label, 1027 intptr_t FindExternalLabel(const ExternalLabel* label,
1002 Patchability patchable); 1028 Patchability patchable);
1003 intptr_t FindImmediate(int64_t imm); 1029 intptr_t FindImmediate(int64_t imm);
1004 void LoadExternalLabel(Register dst, 1030 void LoadExternalLabel(Register dst,
1005 const ExternalLabel* label, 1031 const ExternalLabel* label,
1006 Patchability patchable, 1032 Patchability patchable,
1007 Register pp); 1033 Register pp);
1008 bool CanLoadFromObjectPool(const Object& object); 1034 bool CanLoadFromObjectPool(const Object& object);
1009 void LoadWordFromPoolOffset(Register dst, Register pp, int32_t offset); 1035 void LoadWordFromPoolOffset(Register dst, Register pp, int32_t offset);
1036 void LoadWordFromPoolOffset(Register dst, Register pp, Register r) {
1037 UNREACHABLE();
1038 }
1010 1039
1011 inline void EmitUint8(uint8_t value); 1040 inline void EmitUint8(uint8_t value);
1012 inline void EmitInt32(int32_t value); 1041 inline void EmitInt32(int32_t value);
1013 inline void EmitInt64(int64_t value); 1042 inline void EmitInt64(int64_t value);
1014 1043
1015 inline void EmitRegisterREX(Register reg, uint8_t rex); 1044 inline void EmitRegisterREX(Register reg, uint8_t rex);
1016 inline void EmitRegisterOperand(int rm, int reg); 1045 inline void EmitRegisterOperand(int rm, int reg);
1017 inline void EmitOperandREX(int rm, const Operand& operand, uint8_t rex); 1046 inline void EmitOperandREX(int rm, const Operand& operand, uint8_t rex);
1018 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); 1047 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg);
1019 inline void EmitFixup(AssemblerFixup* fixup); 1048 inline void EmitFixup(AssemblerFixup* fixup);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 } 1156 }
1128 1157
1129 1158
1130 inline void Assembler::EmitOperandSizeOverride() { 1159 inline void Assembler::EmitOperandSizeOverride() {
1131 EmitUint8(0x66); 1160 EmitUint8(0x66);
1132 } 1161 }
1133 1162
1134 } // namespace dart 1163 } // namespace dart
1135 1164
1136 #endif // VM_ASSEMBLER_X64_H_ 1165 #endif // VM_ASSEMBLER_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698