| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 memmove(&encoding_[0], &other.encoding_[0], other.length_); | 84 memmove(&encoding_[0], &other.encoding_[0], other.length_); |
| 85 } | 85 } |
| 86 | 86 |
| 87 Operand& operator=(const Operand& other) { | 87 Operand& operator=(const Operand& other) { |
| 88 length_ = other.length_; | 88 length_ = other.length_; |
| 89 rex_ = other.rex_; | 89 rex_ = other.rex_; |
| 90 memmove(&encoding_[0], &other.encoding_[0], other.length_); | 90 memmove(&encoding_[0], &other.encoding_[0], other.length_); |
| 91 return *this; | 91 return *this; |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool Equals(const Operand& other) { |
| 95 if (length_ != other.length_) return false; |
| 96 if (rex_ != other.rex_) return false; |
| 97 for (uint8_t i = 0; i < length_; i++) { |
| 98 if (encoding_[i] != other.encoding_[i]) return false; |
| 99 } |
| 100 return true; |
| 101 } |
| 102 |
| 94 protected: | 103 protected: |
| 95 Operand() : length_(0), rex_(REX_NONE) { } // Needed by subclass Address. | 104 Operand() : length_(0), rex_(REX_NONE) { } // Needed by subclass Address. |
| 96 | 105 |
| 97 void SetModRM(int mod, Register rm) { | 106 void SetModRM(int mod, Register rm) { |
| 98 ASSERT((mod & ~3) == 0); | 107 ASSERT((mod & ~3) == 0); |
| 99 if ((rm > 7) && !((rm == R12) && (mod != 3))) { | 108 if ((rm > 7) && !((rm == R12) && (mod != 3))) { |
| 100 rex_ |= REX_B; | 109 rex_ |= REX_B; |
| 101 } | 110 } |
| 102 encoding_[0] = (mod << 6) | (rm & 7); | 111 encoding_[0] = (mod << 6) | (rm & 7); |
| 103 length_ = 1; | 112 length_ = 1; |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 } | 918 } |
| 910 | 919 |
| 911 | 920 |
| 912 inline void Assembler::EmitOperandSizeOverride() { | 921 inline void Assembler::EmitOperandSizeOverride() { |
| 913 EmitUint8(0x66); | 922 EmitUint8(0x66); |
| 914 } | 923 } |
| 915 | 924 |
| 916 } // namespace dart | 925 } // namespace dart |
| 917 | 926 |
| 918 #endif // VM_ASSEMBLER_X64_H_ | 927 #endif // VM_ASSEMBLER_X64_H_ |
| OLD | NEW |