OLD | NEW |
---|---|
1 // Copyright (c) 2012, 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 |
(...skipping 11 matching lines...) Expand all Loading... | |
23 explicit Immediate(int32_t value) : value_(value) { } | 23 explicit Immediate(int32_t value) : value_(value) { } |
24 | 24 |
25 int32_t value() const { return value_; } | 25 int32_t value() const { return value_; } |
26 | 26 |
27 bool is_int8() const { return Utils::IsInt(8, value_); } | 27 bool is_int8() const { return Utils::IsInt(8, value_); } |
28 bool is_uint8() const { return Utils::IsUint(8, value_); } | 28 bool is_uint8() const { return Utils::IsUint(8, value_); } |
29 bool is_uint16() const { return Utils::IsUint(16, value_); } | 29 bool is_uint16() const { return Utils::IsUint(16, value_); } |
30 | 30 |
31 private: | 31 private: |
32 const int32_t value_; | 32 const int32_t value_; |
33 | 33 DISALLOW_ALLOCATION(); |
34 // TODO(5411081): Add DISALLOW_COPY_AND_ASSIGN(Immediate) once the mac | |
35 // build issue is resolved. | |
36 }; | 34 }; |
37 | 35 |
38 | 36 |
39 class Operand : public ValueObject { | 37 class Operand : public ValueObject { |
40 public: | 38 public: |
41 uint8_t mod() const { | 39 uint8_t mod() const { |
42 return (encoding_at(0) >> 6) & 3; | 40 return (encoding_at(0) >> 6) & 3; |
43 } | 41 } |
44 | 42 |
45 Register rm() const { | 43 Register rm() const { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 | 107 |
110 explicit Operand(Register reg) { SetModRM(3, reg); } | 108 explicit Operand(Register reg) { SetModRM(3, reg); } |
111 | 109 |
112 // Get the operand encoding byte at the given index. | 110 // Get the operand encoding byte at the given index. |
113 uint8_t encoding_at(int index) const { | 111 uint8_t encoding_at(int index) const { |
114 ASSERT(index >= 0 && index < length_); | 112 ASSERT(index >= 0 && index < length_); |
115 return encoding_[index]; | 113 return encoding_[index]; |
116 } | 114 } |
117 | 115 |
118 friend class Assembler; | 116 friend class Assembler; |
119 | 117 DISALLOW_ALLOCATION(); |
120 // TODO(5411081): Add DISALLOW_COPY_AND_ASSIGN(Operand) once the mac | |
121 // build issue is resolved. | |
122 }; | 118 }; |
123 | 119 |
124 | 120 |
125 class Address : public Operand { | 121 class Address : public Operand { |
126 public: | 122 public: |
127 Address(Register base, int32_t disp) { | 123 Address(Register base, int32_t disp) { |
128 if (disp == 0 && base != EBP) { | 124 if (disp == 0 && base != EBP) { |
129 SetModRM(0, base); | 125 SetModRM(0, base); |
130 if (base == ESP) SetSIB(TIMES_1, ESP, base); | 126 if (base == ESP) SetSIB(TIMES_1, ESP, base); |
131 } else if (Utils::IsInt(8, disp)) { | 127 } else if (Utils::IsInt(8, disp)) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 | 160 |
165 static Address Absolute(const uword addr) { | 161 static Address Absolute(const uword addr) { |
166 Address result; | 162 Address result; |
167 result.SetModRM(0, EBP); | 163 result.SetModRM(0, EBP); |
168 result.SetDisp32(addr); | 164 result.SetDisp32(addr); |
169 return result; | 165 return result; |
170 } | 166 } |
171 | 167 |
172 private: | 168 private: |
173 Address() {} | 169 Address() {} |
174 | 170 DISALLOW_ALLOCATION(); |
175 // TODO(5411081): Add DISALLOW_COPY_AND_ASSIGN(Address) once the mac | |
176 // build issue is resolved. | |
177 }; | 171 }; |
178 | 172 |
179 | 173 |
180 class FieldAddress : public Address { | 174 class FieldAddress : public Address { |
181 public: | 175 public: |
182 FieldAddress(Register base, int32_t disp) | 176 FieldAddress(Register base, int32_t disp) |
183 : Address(base, disp - kHeapObjectTag) {} | 177 : Address(base, disp - kHeapObjectTag) {} |
184 FieldAddress(Register base, Register index, ScaleFactor scale, int32_t disp) | 178 FieldAddress(Register base, Register index, ScaleFactor scale, int32_t disp) |
185 : Address(base, index, scale, disp - kHeapObjectTag) {} | 179 : Address(base, index, scale, disp - kHeapObjectTag) {} |
186 }; | 180 }; |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 void Unimplemented(const char* message); | 623 void Unimplemented(const char* message); |
630 void Untested(const char* message); | 624 void Untested(const char* message); |
631 void Unreachable(const char* message); | 625 void Unreachable(const char* message); |
632 | 626 |
633 static void InitializeMemoryWithBreakpoints(uword data, int length); | 627 static void InitializeMemoryWithBreakpoints(uword data, int length); |
634 | 628 |
635 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 629 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
636 const Code::Comments& GetCodeComments() const; | 630 const Code::Comments& GetCodeComments() const; |
637 | 631 |
638 static const char* RegisterName(Register reg); | 632 static const char* RegisterName(Register reg); |
639 static const char* XmmRegisterName(XmmRegister reg); | 633 static const char* FpuRegisterName(XmmRegister reg); |
Ivan Posva
2013/01/16 01:17:56
This looks very asymmetric. Either it should take
regis
2013/01/16 01:55:07
Renamed parameter type.
| |
640 | 634 |
641 private: | 635 private: |
642 AssemblerBuffer buffer_; | 636 AssemblerBuffer buffer_; |
643 int prologue_offset_; | 637 int prologue_offset_; |
644 | 638 |
645 class CodeComment : public ZoneAllocated { | 639 class CodeComment : public ZoneAllocated { |
646 public: | 640 public: |
647 CodeComment(intptr_t pc_offset, const String& comment) | 641 CodeComment(intptr_t pc_offset, const String& comment) |
648 : pc_offset_(pc_offset), comment_(comment) { } | 642 : pc_offset_(pc_offset), comment_(comment) { } |
649 | 643 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
709 } | 703 } |
710 | 704 |
711 | 705 |
712 inline void Assembler::EmitOperandSizeOverride() { | 706 inline void Assembler::EmitOperandSizeOverride() { |
713 EmitUint8(0x66); | 707 EmitUint8(0x66); |
714 } | 708 } |
715 | 709 |
716 } // namespace dart | 710 } // namespace dart |
717 | 711 |
718 #endif // VM_ASSEMBLER_IA32_H_ | 712 #endif // VM_ASSEMBLER_IA32_H_ |
OLD | NEW |