| 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 |
| 11 | 11 |
| 12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
| 13 #include "platform/utils.h" | 13 #include "platform/utils.h" |
| 14 #include "vm/constants_x64.h" | 14 #include "vm/constants_x64.h" |
| 15 #include "vm/locations.h" |
| 15 | 16 |
| 16 namespace dart { | 17 namespace dart { |
| 17 | 18 |
| 18 // Forward declarations. | 19 // Forward declarations. |
| 19 class RuntimeEntry; | 20 class RuntimeEntry; |
| 21 class Location; |
| 20 | 22 |
| 21 class Immediate : public ValueObject { | 23 class Immediate : public ValueObject { |
| 22 public: | 24 public: |
| 23 explicit Immediate(int64_t value) : value_(value) { } | 25 explicit Immediate(int64_t value) : value_(value) { } |
| 24 | 26 |
| 25 Immediate(const Immediate& other) : ValueObject(), value_(other.value_) { } | 27 Immediate(const Immediate& other) : ValueObject(), value_(other.value_) { } |
| 26 | 28 |
| 27 int64_t value() const { return value_; } | 29 int64_t value() const { return value_; } |
| 28 | 30 |
| 29 bool is_int8() const { return Utils::IsInt(8, value_); } | 31 bool is_int8() const { return Utils::IsInt(8, value_); } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 memmove(&encoding_[0], &other.encoding_[0], other.length_); | 86 memmove(&encoding_[0], &other.encoding_[0], other.length_); |
| 85 } | 87 } |
| 86 | 88 |
| 87 Operand& operator=(const Operand& other) { | 89 Operand& operator=(const Operand& other) { |
| 88 length_ = other.length_; | 90 length_ = other.length_; |
| 89 rex_ = other.rex_; | 91 rex_ = other.rex_; |
| 90 memmove(&encoding_[0], &other.encoding_[0], other.length_); | 92 memmove(&encoding_[0], &other.encoding_[0], other.length_); |
| 91 return *this; | 93 return *this; |
| 92 } | 94 } |
| 93 | 95 |
| 94 bool Equals(const Operand& other) { | 96 bool Equals(const Operand& other) const { |
| 95 if (length_ != other.length_) return false; | 97 if (length_ != other.length_) return false; |
| 96 if (rex_ != other.rex_) return false; | 98 if (rex_ != other.rex_) return false; |
| 97 for (uint8_t i = 0; i < length_; i++) { | 99 for (uint8_t i = 0; i < length_; i++) { |
| 98 if (encoding_[i] != other.encoding_[i]) return false; | 100 if (encoding_[i] != other.encoding_[i]) return false; |
| 99 } | 101 } |
| 100 return true; | 102 return true; |
| 101 } | 103 } |
| 102 | 104 |
| 103 protected: | 105 protected: |
| 104 Operand() : length_(0), rex_(REX_NONE) { } // Needed by subclass Address. | 106 Operand() : length_(0), rex_(REX_NONE) { } // Needed by subclass Address. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 SetDisp8(disp); | 203 SetDisp8(disp); |
| 202 } else { | 204 } else { |
| 203 SetModRM(2, RSP); | 205 SetModRM(2, RSP); |
| 204 SetSIB(scale, index, base); | 206 SetSIB(scale, index, base); |
| 205 SetDisp32(disp); | 207 SetDisp32(disp); |
| 206 } | 208 } |
| 207 } | 209 } |
| 208 | 210 |
| 209 Address(const Address& other) : Operand(other) { } | 211 Address(const Address& other) : Operand(other) { } |
| 210 | 212 |
| 213 static Address StackSlotAddress(const Location& stack_slot); |
| 214 |
| 211 Address& operator=(const Address& other) { | 215 Address& operator=(const Address& other) { |
| 212 Operand::operator=(other); | 216 Operand::operator=(other); |
| 213 return *this; | 217 return *this; |
| 214 } | 218 } |
| 215 }; | 219 }; |
| 216 | 220 |
| 217 | 221 |
| 218 class FieldAddress : public Address { | 222 class FieldAddress : public Address { |
| 219 public: | 223 public: |
| 220 FieldAddress(Register base, int32_t disp) | 224 FieldAddress(Register base, int32_t disp) |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 } | 927 } |
| 924 | 928 |
| 925 | 929 |
| 926 inline void Assembler::EmitOperandSizeOverride() { | 930 inline void Assembler::EmitOperandSizeOverride() { |
| 927 EmitUint8(0x66); | 931 EmitUint8(0x66); |
| 928 } | 932 } |
| 929 | 933 |
| 930 } // namespace dart | 934 } // namespace dart |
| 931 | 935 |
| 932 #endif // VM_ASSEMBLER_X64_H_ | 936 #endif // VM_ASSEMBLER_X64_H_ |
| OLD | NEW |