OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 5 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
6 // All Rights Reserved. | 6 // All Rights Reserved. |
7 // | 7 // |
8 // Redistribution and use in source and binary forms, with or without | 8 // Redistribution and use in source and binary forms, with or without |
9 // modification, are permitted provided that the following conditions are | 9 // modification, are permitted provided that the following conditions are |
10 // met: | 10 // met: |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 explicit Operand(Register reg) { | 168 explicit Operand(Register reg) { |
169 Init(reg); | 169 Init(reg); |
170 } | 170 } |
171 | 171 |
172 // [disp/r] | 172 // [disp/r] |
173 explicit Operand(int disp) { | 173 explicit Operand(int disp) { |
174 Init(disp); | 174 Init(disp); |
175 } | 175 } |
176 | 176 |
177 // [base + disp/r] | 177 // [base + disp/r] |
178 explicit Operand(Register base, int disp) { | 178 Operand(Register base, int disp) { |
179 Init(base, disp); | 179 Init(base, disp); |
180 } | 180 } |
181 | 181 |
182 // [base + index*scale + disp/r] | 182 // [base + index*scale + disp/r] |
183 explicit Operand(Register base, | 183 Operand(Register base, Register index, ScaleFactor scale, int disp) { |
184 Register index, | |
185 ScaleFactor scale, | |
186 int disp) { | |
187 Init(base, index, scale, disp); | 184 Init(base, index, scale, disp); |
188 } | 185 } |
189 | 186 |
190 // [index*scale + disp/r] | 187 // [index*scale + disp/r] |
191 explicit Operand(Register index, | 188 Operand(Register index, ScaleFactor scale, int disp) { |
192 ScaleFactor scale, | |
193 int disp) { | |
194 Init(index, scale, disp); | 189 Init(index, scale, disp); |
195 } | 190 } |
196 | 191 |
197 void set_reg(Register reg) { | 192 void set_reg(Register reg) { |
198 ASSERT(len_ > 0); | 193 ASSERT(len_ > 0); |
199 buf_[0] = (buf_[0] & ~0x38) | static_cast<char>(reg << 3); | 194 buf_[0] = (buf_[0] & ~0x38) | static_cast<char>(reg << 3); |
200 } | 195 } |
201 | 196 |
202 char* data() { return buf_; } | 197 char* data() { return buf_; } |
203 int length() { return len_; } | 198 int length() { return len_; } |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 void xchg(Register r1, const Operand& oper) { | 567 void xchg(Register r1, const Operand& oper) { |
573 emit(0x87); emit_operand(r1, oper); | 568 emit(0x87); emit_operand(r1, oper); |
574 } | 569 } |
575 | 570 |
576 private: | 571 private: |
577 int pos_; | 572 int pos_; |
578 char* buf_; | 573 char* buf_; |
579 }; | 574 }; |
580 | 575 |
581 #endif // TRACELINE_ASSEMBLER_H_ | 576 #endif // TRACELINE_ASSEMBLER_H_ |
OLD | NEW |