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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 679 |
680 // 'size' indicates size in bytes and must be in the range 1..8. | 680 // 'size' indicates size in bytes and must be in the range 1..8. |
681 void nop(int size = 1); | 681 void nop(int size = 1); |
682 void int3(); | 682 void int3(); |
683 void hlt(); | 683 void hlt(); |
684 | 684 |
685 static uword GetBreakInstructionFiller() { | 685 static uword GetBreakInstructionFiller() { |
686 return 0xCCCCCCCCCCCCCCCC; | 686 return 0xCCCCCCCCCCCCCCCC; |
687 } | 687 } |
688 | 688 |
689 // Note: verified_mem mode forces far jumps. | |
690 void j(Condition condition, Label* label, bool near = kFarJump); | 689 void j(Condition condition, Label* label, bool near = kFarJump); |
691 | 690 |
692 void jmp(Register reg); | 691 void jmp(Register reg); |
693 void jmp(const Address& address); | 692 void jmp(const Address& address); |
694 // Note: verified_mem mode forces far jumps. | |
695 void jmp(Label* label, bool near = kFarJump); | 693 void jmp(Label* label, bool near = kFarJump); |
696 void jmp(const ExternalLabel* label); | 694 void jmp(const ExternalLabel* label); |
697 void jmp(const StubEntry& stub_entry); | 695 void jmp(const StubEntry& stub_entry); |
698 | 696 |
699 void lock(); | 697 void lock(); |
700 void cmpxchgl(const Address& address, Register reg); | 698 void cmpxchgl(const Address& address, Register reg); |
701 void lock_cmpxchgl(const Address& address, Register reg) { | 699 void lock_cmpxchgl(const Address& address, Register reg) { |
702 lock(); | 700 lock(); |
703 cmpxchgl(address, reg); | 701 cmpxchgl(address, reg); |
704 } | 702 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 // Emit a call that shares its object pool entries with other calls | 775 // Emit a call that shares its object pool entries with other calls |
778 // that have the same equivalence marker. | 776 // that have the same equivalence marker. |
779 void CallWithEquivalence(const StubEntry& stub_entry, | 777 void CallWithEquivalence(const StubEntry& stub_entry, |
780 const Object& equivalence); | 778 const Object& equivalence); |
781 // Unaware of write barrier (use StoreInto* methods for storing to objects). | 779 // Unaware of write barrier (use StoreInto* methods for storing to objects). |
782 // TODO(koda): Add StackAddress/HeapAddress types to prevent misuse. | 780 // TODO(koda): Add StackAddress/HeapAddress types to prevent misuse. |
783 void StoreObject(const Address& dst, const Object& obj); | 781 void StoreObject(const Address& dst, const Object& obj); |
784 void PushObject(const Object& object); | 782 void PushObject(const Object& object); |
785 void CompareObject(Register reg, const Object& object); | 783 void CompareObject(Register reg, const Object& object); |
786 | 784 |
787 // When storing into a heap object field, knowledge of the previous content | |
788 // is expressed through these constants. | |
789 enum FieldContent { | |
790 kEmptyOrSmiOrNull, // Empty = garbage/zapped in release/debug mode. | |
791 kHeapObjectOrSmi, | |
792 kOnlySmi, | |
793 }; | |
794 | |
795 // Destroys value. | 785 // Destroys value. |
796 void StoreIntoObject(Register object, // Object we are storing into. | 786 void StoreIntoObject(Register object, // Object we are storing into. |
797 const Address& dest, // Where we are storing into. | 787 const Address& dest, // Where we are storing into. |
798 Register value, // Value we are storing. | 788 Register value, // Value we are storing. |
799 bool can_value_be_smi = true); | 789 bool can_value_be_smi = true); |
800 | 790 |
801 void StoreIntoObjectNoBarrier(Register object, | 791 void StoreIntoObjectNoBarrier(Register object, |
802 const Address& dest, | 792 const Address& dest, |
803 Register value, | 793 Register value); |
804 FieldContent old_content = kHeapObjectOrSmi); | |
805 void InitializeFieldNoBarrier(Register object, | |
806 const Address& dest, | |
807 Register value) { | |
808 return StoreIntoObjectNoBarrier(object, dest, value, kEmptyOrSmiOrNull); | |
809 } | |
810 void StoreIntoObjectNoBarrier(Register object, | 794 void StoreIntoObjectNoBarrier(Register object, |
811 const Address& dest, | 795 const Address& dest, |
812 const Object& value, | 796 const Object& value); |
813 FieldContent old_content = kHeapObjectOrSmi); | |
814 void InitializeFieldNoBarrier(Register object, | |
815 const Address& dest, | |
816 const Object& value) { | |
817 return StoreIntoObjectNoBarrier(object, dest, value, kEmptyOrSmiOrNull); | |
818 } | |
819 | 797 |
820 // Stores a Smi value into a heap object field that always contains a Smi. | 798 // Stores a Smi value into a heap object field that always contains a Smi. |
821 void StoreIntoSmiField(const Address& dest, Register value); | 799 void StoreIntoSmiField(const Address& dest, Register value); |
822 void ZeroInitSmiField(const Address& dest); | 800 void ZeroInitSmiField(const Address& dest); |
823 // Increments a Smi field. Leaves flags in same state as an 'addq'. | 801 // Increments a Smi field. Leaves flags in same state as an 'addq'. |
824 void IncrementSmiField(const Address& dest, int64_t increment); | 802 void IncrementSmiField(const Address& dest, int64_t increment); |
825 | 803 |
826 void DoubleNegate(XmmRegister d); | 804 void DoubleNegate(XmmRegister d); |
827 void FloatNegate(XmmRegister f); | 805 void FloatNegate(XmmRegister f); |
828 | 806 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 | 1078 |
1101 void EmitGenericShift(bool wide, int rm, Register reg, const Immediate& imm); | 1079 void EmitGenericShift(bool wide, int rm, Register reg, const Immediate& imm); |
1102 void EmitGenericShift(bool wide, int rm, Register operand, Register shifter); | 1080 void EmitGenericShift(bool wide, int rm, Register operand, Register shifter); |
1103 | 1081 |
1104 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); | 1082 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); |
1105 | 1083 |
1106 // Shorter filtering sequence that assumes that value is not a smi. | 1084 // Shorter filtering sequence that assumes that value is not a smi. |
1107 void StoreIntoObjectFilterNoSmi(Register object, | 1085 void StoreIntoObjectFilterNoSmi(Register object, |
1108 Register value, | 1086 Register value, |
1109 Label* no_update); | 1087 Label* no_update); |
1110 #if defined(DEBUG) | |
1111 void VerifyUninitialized(const Address& address); | |
1112 void VerifyObjectOrSmi(const Address& address); | |
1113 void VerifySmi(const Address& address, const char* stop_msg = "Expected Smi"); | |
1114 #endif // DEBUG | |
1115 // Like VerifiedMemory::Verify(address, kWordSize) and ::Write, but also, | |
1116 // in DEBUG mode, verifies that 'address' has content of type 'old_content'. | |
1117 void VerifyHeapWord(const Address& address, FieldContent old_content); | |
1118 void VerifiedWrite(const Address& dest, | |
1119 Register value, | |
1120 FieldContent old_content); | |
1121 // Unaware of write barrier (use StoreInto* methods for storing to objects). | 1088 // Unaware of write barrier (use StoreInto* methods for storing to objects). |
1122 void MoveImmediate(const Address& dst, const Immediate& imm); | 1089 void MoveImmediate(const Address& dst, const Immediate& imm); |
1123 | 1090 |
1124 void ComputeCounterAddressesForCid(intptr_t cid, | 1091 void ComputeCounterAddressesForCid(intptr_t cid, |
1125 Heap::Space space, | 1092 Heap::Space space, |
1126 Address* count_address, | 1093 Address* count_address, |
1127 Address* size_address); | 1094 Address* size_address); |
1128 DISALLOW_ALLOCATION(); | 1095 DISALLOW_ALLOCATION(); |
1129 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1096 DISALLOW_COPY_AND_ASSIGN(Assembler); |
1130 }; | 1097 }; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 } | 1168 } |
1202 | 1169 |
1203 | 1170 |
1204 inline void Assembler::EmitOperandSizeOverride() { | 1171 inline void Assembler::EmitOperandSizeOverride() { |
1205 EmitUint8(0x66); | 1172 EmitUint8(0x66); |
1206 } | 1173 } |
1207 | 1174 |
1208 } // namespace dart | 1175 } // namespace dart |
1209 | 1176 |
1210 #endif // VM_ASSEMBLER_X64_H_ | 1177 #endif // VM_ASSEMBLER_X64_H_ |
OLD | NEW |