| 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_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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 void call(Register reg); | 349 void call(Register reg); |
| 350 void call(const Address& address); | 350 void call(const Address& address); |
| 351 void call(Label* label); | 351 void call(Label* label); |
| 352 void call(const ExternalLabel* label); | 352 void call(const ExternalLabel* label); |
| 353 | 353 |
| 354 static const intptr_t kCallExternalLabelSize = 10; | 354 static const intptr_t kCallExternalLabelSize = 10; |
| 355 | 355 |
| 356 void pushq(Register reg); | 356 void pushq(Register reg); |
| 357 void pushq(const Address& address); | 357 void pushq(const Address& address); |
| 358 void pushq(const Immediate& imm); | 358 void pushq(const Immediate& imm); |
| 359 void PushImmediate(const Immediate& imm, Register pp); |
| 359 | 360 |
| 360 void popq(Register reg); | 361 void popq(Register reg); |
| 361 void popq(const Address& address); | 362 void popq(const Address& address); |
| 362 | 363 |
| 363 void setcc(Condition condition, ByteRegister dst); | 364 void setcc(Condition condition, ByteRegister dst); |
| 364 | 365 |
| 365 void movl(Register dst, Register src); | 366 void movl(Register dst, Register src); |
| 366 void movl(Register dst, const Immediate& imm); | 367 void movl(Register dst, const Immediate& imm); |
| 367 void movl(Register dst, const Address& src); | 368 void movl(Register dst, const Address& src); |
| 368 void movl(const Address& dst, Register src); | 369 void movl(const Address& dst, Register src); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 void cmpl(Register reg0, Register reg1); | 483 void cmpl(Register reg0, Register reg1); |
| 483 void cmpl(Register reg, const Address& address); | 484 void cmpl(Register reg, const Address& address); |
| 484 void cmpl(const Address& address, const Immediate& imm); | 485 void cmpl(const Address& address, const Immediate& imm); |
| 485 | 486 |
| 486 void cmpq(Register reg, const Immediate& imm); | 487 void cmpq(Register reg, const Immediate& imm); |
| 487 void cmpq(const Address& address, Register reg); | 488 void cmpq(const Address& address, Register reg); |
| 488 void cmpq(const Address& address, const Immediate& imm); | 489 void cmpq(const Address& address, const Immediate& imm); |
| 489 void cmpq(Register reg0, Register reg1); | 490 void cmpq(Register reg0, Register reg1); |
| 490 void cmpq(Register reg, const Address& address); | 491 void cmpq(Register reg, const Address& address); |
| 491 | 492 |
| 493 void CompareImmediate(Register reg, const Immediate& imm, Register pp); |
| 494 void CompareImmediate(const Address& address, const Immediate& imm, |
| 495 Register pp); |
| 496 |
| 492 void testl(Register reg1, Register reg2); | 497 void testl(Register reg1, Register reg2); |
| 493 void testl(Register reg, const Immediate& imm); | 498 void testl(Register reg, const Immediate& imm); |
| 494 | 499 |
| 495 void testq(Register reg1, Register reg2); | 500 void testq(Register reg1, Register reg2); |
| 496 void testq(Register reg, const Immediate& imm); | 501 void testq(Register reg, const Immediate& imm); |
| 497 | 502 |
| 498 void andl(Register dst, Register src); | 503 void andl(Register dst, Register src); |
| 499 void andl(Register dst, const Immediate& imm); | 504 void andl(Register dst, const Immediate& imm); |
| 500 | 505 |
| 501 void orl(Register dst, Register src); | 506 void orl(Register dst, Register src); |
| 502 void orl(Register dst, const Immediate& imm); | 507 void orl(Register dst, const Immediate& imm); |
| 503 | 508 |
| 504 void xorl(Register dst, Register src); | 509 void xorl(Register dst, Register src); |
| 505 | 510 |
| 506 void andq(Register dst, Register src); | 511 void andq(Register dst, Register src); |
| 507 void andq(Register dst, const Address& address); | 512 void andq(Register dst, const Address& address); |
| 508 void andq(Register dst, const Immediate& imm); | 513 void andq(Register dst, const Immediate& imm); |
| 514 void AndImmediate(Register dst, const Immediate& imm, Register pp); |
| 509 | 515 |
| 510 void orq(Register dst, Register src); | 516 void orq(Register dst, Register src); |
| 511 void orq(Register dst, const Address& address); | 517 void orq(Register dst, const Address& address); |
| 512 void orq(Register dst, const Immediate& imm); | 518 void orq(Register dst, const Immediate& imm); |
| 519 void OrImmediate(Register dst, const Immediate& imm, Register pp); |
| 513 | 520 |
| 514 void xorq(Register dst, Register src); | 521 void xorq(Register dst, Register src); |
| 515 void xorq(Register dst, const Address& address); | 522 void xorq(Register dst, const Address& address); |
| 516 void xorq(const Address& dst, Register src); | 523 void xorq(const Address& dst, Register src); |
| 517 void xorq(Register dst, const Immediate& imm); | 524 void xorq(Register dst, const Immediate& imm); |
| 525 void XorImmediate(Register dst, const Immediate& imm, Register pp); |
| 518 | 526 |
| 519 void addl(Register dst, Register src); | 527 void addl(Register dst, Register src); |
| 520 void addl(const Address& address, const Immediate& imm); | 528 void addl(const Address& address, const Immediate& imm); |
| 521 | 529 |
| 522 void addq(Register dst, Register src); | 530 void addq(Register dst, Register src); |
| 523 void addq(Register reg, const Immediate& imm); | 531 void addq(Register reg, const Immediate& imm); |
| 524 void addq(Register reg, const Address& address); | 532 void addq(Register reg, const Address& address); |
| 525 void addq(const Address& address, const Immediate& imm); | 533 void addq(const Address& address, const Immediate& imm); |
| 526 void addq(const Address& address, Register reg); | 534 void addq(const Address& address, Register reg); |
| 527 | 535 |
| 528 void adcl(Register dst, Register src); | 536 void adcl(Register dst, Register src); |
| 529 | 537 |
| 530 void subl(Register dst, Register src); | 538 void subl(Register dst, Register src); |
| 531 | 539 |
| 532 void cdq(); | 540 void cdq(); |
| 533 void cqo(); | 541 void cqo(); |
| 534 | 542 |
| 535 void idivl(Register reg); | 543 void idivl(Register reg); |
| 536 void idivq(Register reg); | 544 void idivq(Register reg); |
| 537 | 545 |
| 538 void imull(Register dst, Register src); | 546 void imull(Register dst, Register src); |
| 539 void imull(Register reg, const Immediate& imm); | 547 void imull(Register reg, const Immediate& imm); |
| 540 | 548 |
| 541 void imulq(Register dst, Register src); | 549 void imulq(Register dst, Register src); |
| 542 void imulq(Register dst, const Address& address); | 550 void imulq(Register dst, const Address& address); |
| 543 void imulq(Register dst, const Immediate& imm); | 551 void imulq(Register dst, const Immediate& imm); |
| 552 void MulImmediate(Register reg, const Immediate& imm, Register pp); |
| 544 | 553 |
| 545 void subq(Register dst, Register src); | 554 void subq(Register dst, Register src); |
| 546 void subq(Register reg, const Immediate& imm); | 555 void subq(Register reg, const Immediate& imm); |
| 547 void subq(Register reg, const Address& address); | 556 void subq(Register reg, const Address& address); |
| 557 void subq(const Address& address, Register reg); |
| 558 void subq(const Address& address, const Immediate& imm); |
| 548 | 559 |
| 549 void shll(Register reg, const Immediate& imm); | 560 void shll(Register reg, const Immediate& imm); |
| 550 void shll(Register operand, Register shifter); | 561 void shll(Register operand, Register shifter); |
| 551 void shrl(Register reg, const Immediate& imm); | 562 void shrl(Register reg, const Immediate& imm); |
| 552 void shrl(Register operand, Register shifter); | 563 void shrl(Register operand, Register shifter); |
| 553 void sarl(Register reg, const Immediate& imm); | 564 void sarl(Register reg, const Immediate& imm); |
| 554 void sarl(Register operand, Register shifter); | 565 void sarl(Register operand, Register shifter); |
| 555 | 566 |
| 556 void shlq(Register reg, const Immediate& imm); | 567 void shlq(Register reg, const Immediate& imm); |
| 557 void shlq(Register operand, Register shifter); | 568 void shlq(Register operand, Register shifter); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 /* | 661 /* |
| 651 * Macros for High-level operations and implemented on all architectures. | 662 * Macros for High-level operations and implemented on all architectures. |
| 652 */ | 663 */ |
| 653 | 664 |
| 654 void CompareRegisters(Register a, Register b); | 665 void CompareRegisters(Register a, Register b); |
| 655 | 666 |
| 656 // Issues a move instruction if 'to' is not the same as 'from'. | 667 // Issues a move instruction if 'to' is not the same as 'from'. |
| 657 void MoveRegister(Register to, Register from); | 668 void MoveRegister(Register to, Register from); |
| 658 void PopRegister(Register r); | 669 void PopRegister(Register r); |
| 659 | 670 |
| 660 void AddImmediate(Register reg, const Immediate& imm); | 671 void AddImmediate(Register reg, const Immediate& imm, Register pp); |
| 672 void AddImmediate(const Address& address, const Immediate& imm, Register pp); |
| 661 | 673 |
| 662 void Drop(intptr_t stack_elements); | 674 void Drop(intptr_t stack_elements); |
| 663 | 675 |
| 664 enum Patchability { | 676 enum Patchability { |
| 665 kPatchable, | 677 kPatchable, |
| 666 kNotPatchable, | 678 kNotPatchable, |
| 667 }; | 679 }; |
| 668 | 680 |
| 681 bool CanLoadImmediateFromPool(const Immediate& imm, Register pp); |
| 682 void LoadImmediate(Register reg, const Immediate& imm, Register pp); |
| 683 void LoadImmediate(const Address& dst, const Immediate& imm, Register pp); |
| 669 void LoadObject(Register dst, const Object& obj, Register pp); | 684 void LoadObject(Register dst, const Object& obj, Register pp); |
| 670 void JmpPatchable(const ExternalLabel* label, Register pp); | 685 void JmpPatchable(const ExternalLabel* label, Register pp); |
| 671 void Jmp(const ExternalLabel* label, Register pp); | 686 void Jmp(const ExternalLabel* label, Register pp); |
| 672 void J(Condition condition, const ExternalLabel* label, Register pp); | 687 void J(Condition condition, const ExternalLabel* label, Register pp); |
| 673 void CallPatchable(const ExternalLabel* label); | 688 void CallPatchable(const ExternalLabel* label); |
| 674 void Call(const ExternalLabel* label, Register pp); | 689 void Call(const ExternalLabel* label, Register pp); |
| 675 void StoreObject(const Address& dst, const Object& obj); | 690 void StoreObject(const Address& dst, const Object& obj, Register pp); |
| 676 void PushObject(const Object& object); | 691 void PushObject(const Object& object, Register pp); |
| 677 void CompareObject(Register reg, const Object& object); | 692 void CompareObject(Register reg, const Object& object, Register pp); |
| 678 void LoadDoubleConstant(XmmRegister dst, double value); | 693 void LoadDoubleConstant(XmmRegister dst, double value); |
| 679 | 694 |
| 680 // Destroys value. | 695 // Destroys value. |
| 681 void StoreIntoObject(Register object, // Object we are storing into. | 696 void StoreIntoObject(Register object, // Object we are storing into. |
| 682 const Address& dest, // Where we are storing into. | 697 const Address& dest, // Where we are storing into. |
| 683 Register value, // Value we are storing. | 698 Register value, // Value we are storing. |
| 684 bool can_value_be_smi = true); | 699 bool can_value_be_smi = true); |
| 685 | 700 |
| 686 void StoreIntoObjectNoBarrier(Register object, | 701 void StoreIntoObjectNoBarrier(Register object, |
| 687 const Address& dest, | 702 const Address& dest, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 // pushq rbp (size is 1 byte) | 820 // pushq rbp (size is 1 byte) |
| 806 // movq rbp, rsp (size is 3 bytes) | 821 // movq rbp, rsp (size is 3 bytes) |
| 807 // call L (size is 5 bytes) | 822 // call L (size is 5 bytes) |
| 808 // L: | 823 // L: |
| 809 static const intptr_t kEntryPointToPcMarkerOffset = 9; | 824 static const intptr_t kEntryPointToPcMarkerOffset = 9; |
| 810 | 825 |
| 811 // Inlined allocation of an instance of class 'cls', code has no runtime | 826 // Inlined allocation of an instance of class 'cls', code has no runtime |
| 812 // calls. Jump to 'failure' if the instance cannot be allocated here. | 827 // calls. Jump to 'failure' if the instance cannot be allocated here. |
| 813 // Allocated instance is returned in 'instance_reg'. | 828 // Allocated instance is returned in 'instance_reg'. |
| 814 // Only the tags field of the object is initialized. | 829 // Only the tags field of the object is initialized. |
| 830 // Loads large immediates from the object pool with pool pointer in PP if it |
| 831 // is not kNoRegister |
| 815 void TryAllocate(const Class& cls, | 832 void TryAllocate(const Class& cls, |
| 816 Label* failure, | 833 Label* failure, |
| 817 bool near_jump, | 834 bool near_jump, |
| 818 Register instance_reg); | 835 Register instance_reg, |
| 836 Register pp); |
| 819 | 837 |
| 820 // Debugging and bringup support. | 838 // Debugging and bringup support. |
| 821 void Stop(const char* message); | 839 void Stop(const char* message); |
| 822 void Unimplemented(const char* message); | 840 void Unimplemented(const char* message); |
| 823 void Untested(const char* message); | 841 void Untested(const char* message); |
| 824 void Unreachable(const char* message); | 842 void Unreachable(const char* message); |
| 825 | 843 |
| 826 static void InitializeMemoryWithBreakpoints(uword data, int length); | 844 static void InitializeMemoryWithBreakpoints(uword data, int length); |
| 827 | 845 |
| 828 static const char* RegisterName(Register reg); | 846 static const char* RegisterName(Register reg); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 const String& comment_; | 912 const String& comment_; |
| 895 | 913 |
| 896 DISALLOW_COPY_AND_ASSIGN(CodeComment); | 914 DISALLOW_COPY_AND_ASSIGN(CodeComment); |
| 897 }; | 915 }; |
| 898 | 916 |
| 899 GrowableArray<CodeComment*> comments_; | 917 GrowableArray<CodeComment*> comments_; |
| 900 | 918 |
| 901 intptr_t FindObject(const Object& obj, Patchability patchable); | 919 intptr_t FindObject(const Object& obj, Patchability patchable); |
| 902 intptr_t FindExternalLabel(const ExternalLabel* label, | 920 intptr_t FindExternalLabel(const ExternalLabel* label, |
| 903 Patchability patchable); | 921 Patchability patchable); |
| 922 intptr_t FindImmediate(int64_t imm); |
| 904 void LoadExternalLabel(Register dst, | 923 void LoadExternalLabel(Register dst, |
| 905 const ExternalLabel* label, | 924 const ExternalLabel* label, |
| 906 Patchability patchable, | 925 Patchability patchable, |
| 907 Register pp); | 926 Register pp); |
| 908 bool CanLoadFromObjectPool(const Object& object); | 927 bool CanLoadFromObjectPool(const Object& object); |
| 909 void LoadWordFromPoolOffset(Register dst, Register pp, int32_t offset); | 928 void LoadWordFromPoolOffset(Register dst, Register pp, int32_t offset); |
| 910 | 929 |
| 911 inline void EmitUint8(uint8_t value); | 930 inline void EmitUint8(uint8_t value); |
| 912 inline void EmitInt32(int32_t value); | 931 inline void EmitInt32(int32_t value); |
| 913 inline void EmitInt64(int64_t value); | 932 inline void EmitInt64(int64_t value); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 } | 1042 } |
| 1024 | 1043 |
| 1025 | 1044 |
| 1026 inline void Assembler::EmitOperandSizeOverride() { | 1045 inline void Assembler::EmitOperandSizeOverride() { |
| 1027 EmitUint8(0x66); | 1046 EmitUint8(0x66); |
| 1028 } | 1047 } |
| 1029 | 1048 |
| 1030 } // namespace dart | 1049 } // namespace dart |
| 1031 | 1050 |
| 1032 #endif // VM_ASSEMBLER_X64_H_ | 1051 #endif // VM_ASSEMBLER_X64_H_ |
| OLD | NEW |