OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 SetModRM(1, RSP); | 201 SetModRM(1, RSP); |
202 SetSIB(scale, index, base); | 202 SetSIB(scale, index, base); |
203 SetDisp8(disp); | 203 SetDisp8(disp); |
204 } else { | 204 } else { |
205 SetModRM(2, RSP); | 205 SetModRM(2, RSP); |
206 SetSIB(scale, index, base); | 206 SetSIB(scale, index, base); |
207 SetDisp32(disp); | 207 SetDisp32(disp); |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 static Address Absolute(const uword addr) { | |
212 UNIMPLEMENTED(); | |
213 Address result; | |
214 result.SetModRM(0, RBP); | |
215 result.SetDisp32(addr); | |
216 return result; | |
217 } | |
218 | |
219 private: | 211 private: |
220 Address() {} | 212 Address() {} |
221 | 213 |
222 // TODO(5411081): Add DISALLOW_COPY_AND_ASSIGN(Address) once the mac | 214 // TODO(5411081): Add DISALLOW_COPY_AND_ASSIGN(Address) once the mac |
223 // build issue is resolved. | 215 // build issue is resolved. |
224 }; | 216 }; |
225 | 217 |
226 | 218 |
227 class FieldAddress : public Address { | 219 class FieldAddress : public Address { |
228 public: | 220 public: |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 static const bool kFarJump = false; | 303 static const bool kFarJump = false; |
312 | 304 |
313 /* | 305 /* |
314 * Emit Machine Instructions. | 306 * Emit Machine Instructions. |
315 */ | 307 */ |
316 void call(Register reg); | 308 void call(Register reg); |
317 void call(const Address& address); | 309 void call(const Address& address); |
318 void call(Label* label); | 310 void call(Label* label); |
319 void call(const ExternalLabel* label); | 311 void call(const ExternalLabel* label); |
320 | 312 |
321 static const intptr_t kCallExternalLabelSize = 5; | 313 static const intptr_t kCallExternalLabelSize = 13; |
322 | 314 |
323 void pushq(Register reg); | 315 void pushq(Register reg); |
324 void pushq(const Address& address); | 316 void pushq(const Address& address); |
325 void pushq(const Immediate& imm); | 317 void pushq(const Immediate& imm); |
326 | 318 |
327 void popq(Register reg); | 319 void popq(Register reg); |
328 void popq(const Address& address); | 320 void popq(const Address& address); |
329 | 321 |
330 void movl(Register dst, Register src); | 322 void movl(Register dst, Register src); |
331 void movl(Register dst, const Immediate& imm); | 323 void movl(Register dst, const Immediate& imm); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 void idivl(Register reg); | 421 void idivl(Register reg); |
430 void idivq(Register reg); | 422 void idivq(Register reg); |
431 | 423 |
432 void imull(Register dst, Register src); | 424 void imull(Register dst, Register src); |
433 void imull(Register reg, const Immediate& imm); | 425 void imull(Register reg, const Immediate& imm); |
434 | 426 |
435 void imulq(Register dst, Register src); | 427 void imulq(Register dst, Register src); |
436 | 428 |
437 void subq(Register dst, Register src); | 429 void subq(Register dst, Register src); |
438 void subq(Register reg, const Immediate& imm); | 430 void subq(Register reg, const Immediate& imm); |
| 431 void subq(Register reg, const Address& address); |
439 | 432 |
440 void shll(Register reg, const Immediate& imm); | 433 void shll(Register reg, const Immediate& imm); |
441 void shll(Register operand, Register shifter); | 434 void shll(Register operand, Register shifter); |
442 void shrl(Register reg, const Immediate& imm); | 435 void shrl(Register reg, const Immediate& imm); |
443 void shrl(Register operand, Register shifter); | 436 void shrl(Register operand, Register shifter); |
444 void sarl(Register reg, const Immediate& imm); | 437 void sarl(Register reg, const Immediate& imm); |
445 void sarl(Register operand, Register shifter); | 438 void sarl(Register operand, Register shifter); |
446 | 439 |
447 void shlq(Register reg, const Immediate& imm); | 440 void shlq(Register reg, const Immediate& imm); |
448 void shlq(Register operand, Register shifter); | 441 void shlq(Register operand, Register shifter); |
449 void shrq(Register reg, const Immediate& imm); | 442 void shrq(Register reg, const Immediate& imm); |
450 void shrq(Register operand, Register shifter); | 443 void shrq(Register operand, Register shifter); |
451 void sarq(Register reg, const Immediate& imm); | 444 void sarq(Register reg, const Immediate& imm); |
452 void sarq(Register operand, Register shifter); | 445 void sarq(Register operand, Register shifter); |
453 | 446 |
454 void incl(const Address& address); | 447 void incl(const Address& address); |
455 void decl(const Address& address); | 448 void decl(const Address& address); |
456 | 449 |
457 void incq(Register reg); | 450 void incq(Register reg); |
458 void incq(const Address& address); | 451 void incq(const Address& address); |
459 void decq(Register reg); | 452 void decq(Register reg); |
460 void decq(const Address& address); | 453 void decq(const Address& address); |
461 | 454 |
462 void negl(Register reg); | 455 void negl(Register reg); |
463 void negq(Register reg); | 456 void negq(Register reg); |
464 | 457 |
465 void enter(const Immediate& imm); | 458 void enter(const Immediate& imm); |
466 void leave(); | 459 void leave(); |
| 460 void ret(); |
467 | 461 |
468 void ret(); | 462 // 'size' indicates size in bytes and must be in the range 1..8. |
469 void nop(); | 463 void nop(int size = 1); |
470 void int3(); | 464 void int3(); |
471 void hlt(); | 465 void hlt(); |
472 | 466 |
473 void j(Condition condition, Label* label, bool near = kFarJump); | 467 void j(Condition condition, Label* label, bool near = kFarJump); |
| 468 void j(Condition condition, const ExternalLabel* label); |
474 | 469 |
475 void jmp(Register reg); | 470 void jmp(Register reg); |
476 void jmp(Label* label, bool near = kFarJump); | 471 void jmp(Label* label, bool near = kFarJump); |
477 void jmp(const ExternalLabel* label); | 472 void jmp(const ExternalLabel* label); |
478 | 473 |
479 void lock(); | 474 void lock(); |
480 void cmpxchgl(const Address& address, Register reg); | 475 void cmpxchgl(const Address& address, Register reg); |
481 void lock_cmpxchgl(const Address& address, Register reg) { | 476 void lock_cmpxchgl(const Address& address, Register reg) { |
482 lock(); | 477 lock(); |
483 cmpxchgl(address, reg); | 478 cmpxchgl(address, reg); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 } | 612 } |
618 | 613 |
619 | 614 |
620 inline void Assembler::EmitOperandSizeOverride() { | 615 inline void Assembler::EmitOperandSizeOverride() { |
621 EmitUint8(0x66); | 616 EmitUint8(0x66); |
622 } | 617 } |
623 | 618 |
624 } // namespace dart | 619 } // namespace dart |
625 | 620 |
626 #endif // VM_ASSEMBLER_X64_H_ | 621 #endif // VM_ASSEMBLER_X64_H_ |
OLD | NEW |