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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 void cmpq(const Address& address, const Immediate& imm); | 510 void cmpq(const Address& address, const Immediate& imm); |
511 void cmpq(Register reg0, Register reg1); | 511 void cmpq(Register reg0, Register reg1); |
512 void cmpq(Register reg, const Address& address); | 512 void cmpq(Register reg, const Address& address); |
513 | 513 |
514 void CompareImmediate(Register reg, const Immediate& imm, Register pp); | 514 void CompareImmediate(Register reg, const Immediate& imm, Register pp); |
515 void CompareImmediate(const Address& address, const Immediate& imm, | 515 void CompareImmediate(const Address& address, const Immediate& imm, |
516 Register pp); | 516 Register pp); |
517 | 517 |
518 void testl(Register reg1, Register reg2); | 518 void testl(Register reg1, Register reg2); |
519 void testl(Register reg, const Immediate& imm); | 519 void testl(Register reg, const Immediate& imm); |
| 520 void testb(const Address& address, const Immediate& imm); |
520 | 521 |
521 void testq(Register reg1, Register reg2); | 522 void testq(Register reg1, Register reg2); |
522 void testq(Register reg, const Immediate& imm); | 523 void testq(Register reg, const Immediate& imm); |
523 void TestImmediate(Register dst, const Immediate& imm, Register pp); | 524 void TestImmediate(Register dst, const Immediate& imm, Register pp); |
524 | 525 |
525 void andl(Register dst, Register src); | 526 void andl(Register dst, Register src); |
526 void andl(Register dst, const Immediate& imm); | 527 void andl(Register dst, const Immediate& imm); |
527 | 528 |
528 void orl(Register dst, Register src); | 529 void orl(Register dst, Register src); |
529 void orl(Register dst, const Immediate& imm); | 530 void orl(Register dst, const Immediate& imm); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 void Jmp(const ExternalLabel* label, Register pp); | 750 void Jmp(const ExternalLabel* label, Register pp); |
750 void J(Condition condition, const ExternalLabel* label, Register pp); | 751 void J(Condition condition, const ExternalLabel* label, Register pp); |
751 void CallPatchable(const ExternalLabel* label); | 752 void CallPatchable(const ExternalLabel* label); |
752 void Call(const ExternalLabel* label, Register pp); | 753 void Call(const ExternalLabel* label, Register pp); |
753 // Unaware of write barrier (use StoreInto* methods for storing to objects). | 754 // Unaware of write barrier (use StoreInto* methods for storing to objects). |
754 // TODO(koda): Add StackAddress/HeapAddress types to prevent misuse. | 755 // TODO(koda): Add StackAddress/HeapAddress types to prevent misuse. |
755 void StoreObject(const Address& dst, const Object& obj, Register pp); | 756 void StoreObject(const Address& dst, const Object& obj, Register pp); |
756 void PushObject(const Object& object, Register pp); | 757 void PushObject(const Object& object, Register pp); |
757 void CompareObject(Register reg, const Object& object, Register pp); | 758 void CompareObject(Register reg, const Object& object, Register pp); |
758 | 759 |
| 760 // When storing into a heap object field, knowledge of the previous content |
| 761 // is expressed through these constants. |
| 762 enum FieldContent { |
| 763 kEmptyOrSmiOrNull, // Empty = garbage/zapped in release/debug mode. |
| 764 kHeapObjectOrSmi, |
| 765 kOnlySmi, |
| 766 }; |
| 767 |
759 // Destroys value. | 768 // Destroys value. |
760 void StoreIntoObject(Register object, // Object we are storing into. | 769 void StoreIntoObject(Register object, // Object we are storing into. |
761 const Address& dest, // Where we are storing into. | 770 const Address& dest, // Where we are storing into. |
762 Register value, // Value we are storing. | 771 Register value, // Value we are storing. |
763 bool can_value_be_smi = true); | 772 bool can_value_be_smi = true); |
764 | 773 |
765 void StoreIntoObjectNoBarrier(Register object, | 774 void StoreIntoObjectNoBarrier(Register object, |
766 const Address& dest, | 775 const Address& dest, |
767 Register value); | 776 Register value, |
| 777 FieldContent old_content = kHeapObjectOrSmi); |
| 778 void InitializeFieldNoBarrier(Register object, |
| 779 const Address& dest, |
| 780 Register value) { |
| 781 return StoreIntoObjectNoBarrier(object, dest, value, kEmptyOrSmiOrNull); |
| 782 } |
768 void StoreIntoObjectNoBarrier(Register object, | 783 void StoreIntoObjectNoBarrier(Register object, |
769 const Address& dest, | 784 const Address& dest, |
770 const Object& value, | 785 const Object& value, |
771 Register pp); | 786 Register pp, |
| 787 FieldContent old_content = kHeapObjectOrSmi); |
| 788 void InitializeFieldNoBarrier(Register object, |
| 789 const Address& dest, |
| 790 const Object& value, |
| 791 Register pp) { |
| 792 return StoreIntoObjectNoBarrier(object, dest, value, pp, kEmptyOrSmiOrNull); |
| 793 } |
772 | 794 |
773 // Stores a Smi value into a heap object field that always contains a Smi. | 795 // Stores a Smi value into a heap object field that always contains a Smi. |
774 void StoreIntoSmiField(const Address& dest, Register value); | 796 void StoreIntoSmiField(const Address& dest, Register value); |
775 void ZeroInitSmiField(const Address& dest); | 797 void ZeroInitSmiField(const Address& dest); |
776 // Increments a Smi field. Leaves flags in same state as an 'addq'. | 798 // Increments a Smi field. Leaves flags in same state as an 'addq'. |
777 void IncrementSmiField(const Address& dest, int64_t increment); | 799 void IncrementSmiField(const Address& dest, int64_t increment); |
778 | 800 |
779 void DoubleNegate(XmmRegister d); | 801 void DoubleNegate(XmmRegister d); |
780 void FloatNegate(XmmRegister f); | 802 void FloatNegate(XmmRegister f); |
781 | 803 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 | 1125 |
1104 void EmitGenericShift(bool wide, int rm, Register reg, const Immediate& imm); | 1126 void EmitGenericShift(bool wide, int rm, Register reg, const Immediate& imm); |
1105 void EmitGenericShift(bool wide, int rm, Register operand, Register shifter); | 1127 void EmitGenericShift(bool wide, int rm, Register operand, Register shifter); |
1106 | 1128 |
1107 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); | 1129 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); |
1108 | 1130 |
1109 // Shorter filtering sequence that assumes that value is not a smi. | 1131 // Shorter filtering sequence that assumes that value is not a smi. |
1110 void StoreIntoObjectFilterNoSmi(Register object, | 1132 void StoreIntoObjectFilterNoSmi(Register object, |
1111 Register value, | 1133 Register value, |
1112 Label* no_update); | 1134 Label* no_update); |
1113 | 1135 #if defined(DEBUG) |
1114 // Analogous to VerifiedMemory::Verify(address, kWordSize). | 1136 void VerifyUninitialized(const Address& address); |
1115 void VerifyHeapWord(const Address& address); | 1137 void VerifyObjectOrSmi(const Address& address); |
1116 // Analogous to VerifiedMemory::Write. | 1138 void VerifySmi(const Address& address, const char* stop_msg = "Expected Smi"); |
1117 void VerifiedWrite(const Address& dest, Register value); | 1139 #endif // DEBUG |
| 1140 // Like VerifiedMemory::Verify(address, kWordSize) and ::Write, but also, |
| 1141 // in DEBUG mode, verifies that 'address' has content of type 'old_content'. |
| 1142 void VerifyHeapWord(const Address& address, FieldContent old_content); |
| 1143 void VerifiedWrite(const Address& dest, |
| 1144 Register value, |
| 1145 FieldContent old_content); |
1118 // Unaware of write barrier (use StoreInto* methods for storing to objects). | 1146 // Unaware of write barrier (use StoreInto* methods for storing to objects). |
1119 void MoveImmediate(const Address& dst, const Immediate& imm, Register pp); | 1147 void MoveImmediate(const Address& dst, const Immediate& imm, Register pp); |
1120 | 1148 |
1121 void ComputeCounterAddressesForCid(intptr_t cid, | 1149 void ComputeCounterAddressesForCid(intptr_t cid, |
1122 Heap::Space space, | 1150 Heap::Space space, |
1123 Address* count_address, | 1151 Address* count_address, |
1124 Address* size_address); | 1152 Address* size_address); |
1125 DISALLOW_ALLOCATION(); | 1153 DISALLOW_ALLOCATION(); |
1126 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1154 DISALLOW_COPY_AND_ASSIGN(Assembler); |
1127 }; | 1155 }; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 } | 1226 } |
1199 | 1227 |
1200 | 1228 |
1201 inline void Assembler::EmitOperandSizeOverride() { | 1229 inline void Assembler::EmitOperandSizeOverride() { |
1202 EmitUint8(0x66); | 1230 EmitUint8(0x66); |
1203 } | 1231 } |
1204 | 1232 |
1205 } // namespace dart | 1233 } // namespace dart |
1206 | 1234 |
1207 #endif // VM_ASSEMBLER_X64_H_ | 1235 #endif // VM_ASSEMBLER_X64_H_ |
OLD | NEW |