| 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 |
| 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_ia32.h" | 14 #include "vm/constants_ia32.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(int32_t value) : value_(value) { } | 25 explicit Immediate(int32_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 int32_t value() const { return value_; } | 29 int32_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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 Operand(const Operand& other) : ValueObject(), length_(other.length_) { | 76 Operand(const Operand& other) : ValueObject(), length_(other.length_) { |
| 75 memmove(&encoding_[0], &other.encoding_[0], other.length_); | 77 memmove(&encoding_[0], &other.encoding_[0], other.length_); |
| 76 } | 78 } |
| 77 | 79 |
| 78 Operand& operator=(const Operand& other) { | 80 Operand& operator=(const Operand& other) { |
| 79 length_ = other.length_; | 81 length_ = other.length_; |
| 80 memmove(&encoding_[0], &other.encoding_[0], other.length_); | 82 memmove(&encoding_[0], &other.encoding_[0], other.length_); |
| 81 return *this; | 83 return *this; |
| 82 } | 84 } |
| 83 | 85 |
| 84 bool Equals(const Operand& other) { | 86 bool Equals(const Operand& other) const { |
| 85 if (length_ != other.length_) return false; | 87 if (length_ != other.length_) return false; |
| 86 for (uint8_t i = 0; i < length_; i++) { | 88 for (uint8_t i = 0; i < length_; i++) { |
| 87 if (encoding_[i] != other.encoding_[i]) return false; | 89 if (encoding_[i] != other.encoding_[i]) return false; |
| 88 } | 90 } |
| 89 return true; | 91 return true; |
| 90 } | 92 } |
| 91 | 93 |
| 92 protected: | 94 protected: |
| 93 Operand() : length_(0) { } // Needed by subclass Address. | 95 Operand() : length_(0) { } // Needed by subclass Address. |
| 94 | 96 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 return *this; | 190 return *this; |
| 189 } | 191 } |
| 190 | 192 |
| 191 static Address Absolute(const uword addr) { | 193 static Address Absolute(const uword addr) { |
| 192 Address result; | 194 Address result; |
| 193 result.SetModRM(0, EBP); | 195 result.SetModRM(0, EBP); |
| 194 result.SetDisp32(addr); | 196 result.SetDisp32(addr); |
| 195 return result; | 197 return result; |
| 196 } | 198 } |
| 197 | 199 |
| 200 static Address StackSlotAddress(const Location& stack_slot); |
| 201 |
| 198 private: | 202 private: |
| 199 Address() { } // Needed by Address::Absolute. | 203 Address() { } // Needed by Address::Absolute. |
| 200 }; | 204 }; |
| 201 | 205 |
| 202 | 206 |
| 203 class FieldAddress : public Address { | 207 class FieldAddress : public Address { |
| 204 public: | 208 public: |
| 205 FieldAddress(Register base, int32_t disp) | 209 FieldAddress(Register base, int32_t disp) |
| 206 : Address(base, disp - kHeapObjectTag) { } | 210 : Address(base, disp - kHeapObjectTag) { } |
| 207 | 211 |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 } | 848 } |
| 845 | 849 |
| 846 | 850 |
| 847 inline void Assembler::EmitOperandSizeOverride() { | 851 inline void Assembler::EmitOperandSizeOverride() { |
| 848 EmitUint8(0x66); | 852 EmitUint8(0x66); |
| 849 } | 853 } |
| 850 | 854 |
| 851 } // namespace dart | 855 } // namespace dart |
| 852 | 856 |
| 853 #endif // VM_ASSEMBLER_IA32_H_ | 857 #endif // VM_ASSEMBLER_IA32_H_ |
| OLD | NEW |