| 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_IA32_H_ | 5 #ifndef VM_ASSEMBLER_IA32_H_ |
| 6 #define VM_ASSEMBLER_IA32_H_ | 6 #define VM_ASSEMBLER_IA32_H_ |
| 7 | 7 |
| 8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
| 9 #error Do not include assembler_ia32.h directly; use assembler.h instead. | 9 #error Do not include assembler_ia32.h directly; use assembler.h instead. |
| 10 #endif | 10 #endif |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 | 629 |
| 630 // 'size' indicates size in bytes and must be in the range 1..8. | 630 // 'size' indicates size in bytes and must be in the range 1..8. |
| 631 void nop(int size = 1); | 631 void nop(int size = 1); |
| 632 void int3(); | 632 void int3(); |
| 633 void hlt(); | 633 void hlt(); |
| 634 | 634 |
| 635 static uword GetBreakInstructionFiller() { | 635 static uword GetBreakInstructionFiller() { |
| 636 return 0xCCCCCCCC; | 636 return 0xCCCCCCCC; |
| 637 } | 637 } |
| 638 | 638 |
| 639 // Note: verified_mem mode forces far jumps. | |
| 640 void j(Condition condition, Label* label, bool near = kFarJump); | 639 void j(Condition condition, Label* label, bool near = kFarJump); |
| 641 void j(Condition condition, const ExternalLabel* label); | 640 void j(Condition condition, const ExternalLabel* label); |
| 642 | 641 |
| 643 void jmp(Register reg); | 642 void jmp(Register reg); |
| 644 // Note: verified_mem mode forces far jumps. | |
| 645 void jmp(Label* label, bool near = kFarJump); | 643 void jmp(Label* label, bool near = kFarJump); |
| 646 void jmp(const ExternalLabel* label); | 644 void jmp(const ExternalLabel* label); |
| 647 | 645 |
| 648 void lock(); | 646 void lock(); |
| 649 void cmpxchgl(const Address& address, Register reg); | 647 void cmpxchgl(const Address& address, Register reg); |
| 650 | 648 |
| 651 void cpuid(); | 649 void cpuid(); |
| 652 | 650 |
| 653 /* | 651 /* |
| 654 * Macros for High-level operations and implemented on all architectures. | 652 * Macros for High-level operations and implemented on all architectures. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 670 void LoadObject(Register dst, const Object& object); | 668 void LoadObject(Register dst, const Object& object); |
| 671 | 669 |
| 672 // If 'object' is a large Smi, xor it with a per-assembler cookie value to | 670 // If 'object' is a large Smi, xor it with a per-assembler cookie value to |
| 673 // prevent user-controlled immediates from appearing in the code stream. | 671 // prevent user-controlled immediates from appearing in the code stream. |
| 674 void LoadObjectSafely(Register dst, const Object& object); | 672 void LoadObjectSafely(Register dst, const Object& object); |
| 675 | 673 |
| 676 void PushObject(const Object& object); | 674 void PushObject(const Object& object); |
| 677 void CompareObject(Register reg, const Object& object); | 675 void CompareObject(Register reg, const Object& object); |
| 678 void LoadDoubleConstant(XmmRegister dst, double value); | 676 void LoadDoubleConstant(XmmRegister dst, double value); |
| 679 | 677 |
| 680 // When storing into a heap object field, knowledge of the previous content | |
| 681 // is expressed through these constants. | |
| 682 enum FieldContent { | |
| 683 kEmptyOrSmiOrNull, // Empty = garbage/zapped in release/debug mode. | |
| 684 kHeapObjectOrSmi, | |
| 685 kOnlySmi, | |
| 686 }; | |
| 687 | |
| 688 void StoreIntoObject(Register object, // Object we are storing into. | 678 void StoreIntoObject(Register object, // Object we are storing into. |
| 689 const Address& dest, // Where we are storing into. | 679 const Address& dest, // Where we are storing into. |
| 690 Register value, // Value we are storing. | 680 Register value, // Value we are storing. |
| 691 bool can_value_be_smi = true); | 681 bool can_value_be_smi = true); |
| 692 | 682 |
| 693 void StoreIntoObjectNoBarrier(Register object, | 683 void StoreIntoObjectNoBarrier(Register object, |
| 694 const Address& dest, | 684 const Address& dest, |
| 695 Register value, | 685 Register value); |
| 696 FieldContent old_content = kHeapObjectOrSmi); | |
| 697 void InitializeFieldNoBarrier(Register object, | |
| 698 const Address& dest, | |
| 699 Register value) { | |
| 700 return StoreIntoObjectNoBarrier(object, dest, value, kEmptyOrSmiOrNull); | |
| 701 } | |
| 702 void StoreIntoObjectNoBarrier(Register object, | 686 void StoreIntoObjectNoBarrier(Register object, |
| 703 const Address& dest, | 687 const Address& dest, |
| 704 const Object& value, | 688 const Object& value); |
| 705 FieldContent old_content = kHeapObjectOrSmi); | |
| 706 void InitializeFieldNoBarrier(Register object, | |
| 707 const Address& dest, | |
| 708 const Object& value) { | |
| 709 return StoreIntoObjectNoBarrier(object, dest, value, kEmptyOrSmiOrNull); | |
| 710 } | |
| 711 | 689 |
| 712 // Stores a Smi value into a heap object field that always contains a Smi. | 690 // Stores a Smi value into a heap object field that always contains a Smi. |
| 713 void StoreIntoSmiField(const Address& dest, Register value); | 691 void StoreIntoSmiField(const Address& dest, Register value); |
| 714 void ZeroInitSmiField(const Address& dest); | 692 void ZeroInitSmiField(const Address& dest); |
| 715 // Increments a Smi field. Leaves flags in same state as an 'addl'. | 693 // Increments a Smi field. Leaves flags in same state as an 'addl'. |
| 716 void IncrementSmiField(const Address& dest, int32_t increment); | 694 void IncrementSmiField(const Address& dest, int32_t increment); |
| 717 | 695 |
| 718 void DoubleNegate(XmmRegister d); | 696 void DoubleNegate(XmmRegister d); |
| 719 void FloatNegate(XmmRegister f); | 697 void FloatNegate(XmmRegister f); |
| 720 | 698 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 | 980 |
| 1003 void EmitGenericShift(int rm, Register reg, const Immediate& imm); | 981 void EmitGenericShift(int rm, Register reg, const Immediate& imm); |
| 1004 void EmitGenericShift(int rm, const Operand& operand, Register shifter); | 982 void EmitGenericShift(int rm, const Operand& operand, Register shifter); |
| 1005 | 983 |
| 1006 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); | 984 void StoreIntoObjectFilter(Register object, Register value, Label* no_update); |
| 1007 | 985 |
| 1008 // Shorter filtering sequence that assumes that value is not a smi. | 986 // Shorter filtering sequence that assumes that value is not a smi. |
| 1009 void StoreIntoObjectFilterNoSmi(Register object, | 987 void StoreIntoObjectFilterNoSmi(Register object, |
| 1010 Register value, | 988 Register value, |
| 1011 Label* no_update); | 989 Label* no_update); |
| 1012 #if defined(DEBUG) | |
| 1013 void VerifyUninitialized(const Address& address); | |
| 1014 void VerifyObjectOrSmi(const Address& address); | |
| 1015 void VerifySmi(const Address& address, const char* stop_msg = "Expected Smi"); | |
| 1016 #endif // DEBUG | |
| 1017 // Like VerifiedMemory::Verify(address, kWordSize) and ::Write, but also, | |
| 1018 // in DEBUG mode, verifies that 'address' has content of type 'old_content'. | |
| 1019 void VerifyHeapWord(const Address& address, FieldContent old_content); | |
| 1020 void VerifiedWrite(const Address& dest, | |
| 1021 Register value, | |
| 1022 FieldContent old_content); | |
| 1023 void UnverifiedStoreOldObject(const Address& dest, const Object& value); | 990 void UnverifiedStoreOldObject(const Address& dest, const Object& value); |
| 1024 | 991 |
| 1025 int32_t jit_cookie(); | 992 int32_t jit_cookie(); |
| 1026 | 993 |
| 1027 AssemblerBuffer buffer_; | 994 AssemblerBuffer buffer_; |
| 1028 ObjectPoolWrapper object_pool_wrapper_; | 995 ObjectPoolWrapper object_pool_wrapper_; |
| 1029 intptr_t prologue_offset_; | 996 intptr_t prologue_offset_; |
| 1030 int32_t jit_cookie_; | 997 int32_t jit_cookie_; |
| 1031 GrowableArray<CodeComment*> comments_; | 998 GrowableArray<CodeComment*> comments_; |
| 1032 Code& code_; | 999 Code& code_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1062 } | 1029 } |
| 1063 | 1030 |
| 1064 | 1031 |
| 1065 inline void Assembler::EmitOperandSizeOverride() { | 1032 inline void Assembler::EmitOperandSizeOverride() { |
| 1066 EmitUint8(0x66); | 1033 EmitUint8(0x66); |
| 1067 } | 1034 } |
| 1068 | 1035 |
| 1069 } // namespace dart | 1036 } // namespace dart |
| 1070 | 1037 |
| 1071 #endif // VM_ASSEMBLER_IA32_H_ | 1038 #endif // VM_ASSEMBLER_IA32_H_ |
| OLD | NEW |