Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: runtime/vm/assembler_arm.h

Issue 12340050: Add DISALLOW_COPY_AND_ASSIGN to subclasses of ValueObject and make ValueObject copyable. Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler.h ('k') | runtime/vm/assembler_ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM_H_ 5 #ifndef VM_ASSEMBLER_ARM_H_
6 #define VM_ASSEMBLER_ARM_H_ 6 #define VM_ASSEMBLER_ARM_H_
7 7
8 #ifndef VM_ASSEMBLER_H_ 8 #ifndef VM_ASSEMBLER_H_
9 #error Do not include assembler_arm.h directly; use assembler.h instead. 9 #error Do not include assembler_arm.h directly; use assembler.h instead.
10 #endif 10 #endif
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 }; 69 };
70 70
71 71
72 // Encodes Addressing Mode 1 - Data-processing operands. 72 // Encodes Addressing Mode 1 - Data-processing operands.
73 class ShifterOperand : public ValueObject { 73 class ShifterOperand : public ValueObject {
74 public: 74 public:
75 // Data-processing operands - Uninitialized. 75 // Data-processing operands - Uninitialized.
76 ShifterOperand() : type_(-1), encoding_(-1) { } 76 ShifterOperand() : type_(-1), encoding_(-1) { }
77 77
78 // Data-processing operands - Copy constructor.
79 ShifterOperand(const ShifterOperand& other)
80 : ValueObject(), type_(other.type_), encoding_(other.encoding_) { }
81
82 // Data-processing operands - Assignment operator.
83 ShifterOperand& operator=(const ShifterOperand& other) {
84 type_ = other.type_;
85 encoding_ = other.encoding_;
86 return *this;
87 }
88
89 // Data-processing operands - Immediate. 78 // Data-processing operands - Immediate.
90 explicit ShifterOperand(uint32_t immediate) { 79 explicit ShifterOperand(uint32_t immediate) {
91 ASSERT(immediate < (1 << kImmed8Bits)); 80 ASSERT(immediate < (1 << kImmed8Bits));
92 type_ = 1; 81 type_ = 1;
93 encoding_ = immediate; 82 encoding_ = immediate;
94 } 83 }
95 84
96 // Data-processing operands - Rotated immediate. 85 // Data-processing operands - Rotated immediate.
97 ShifterOperand(uint32_t rotate, uint32_t immed8) { 86 ShifterOperand(uint32_t rotate, uint32_t immed8) {
98 ASSERT((rotate < (1 << kRotateBits)) && (immed8 < (1 << kImmed8Bits))); 87 ASSERT((rotate < (1 << kRotateBits)) && (immed8 < (1 << kImmed8Bits)));
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 enum Mode { 193 enum Mode {
205 // bit encoding P U W 194 // bit encoding P U W
206 Offset = (8|4|0) << 21, // offset (w/o writeback to base) 195 Offset = (8|4|0) << 21, // offset (w/o writeback to base)
207 PreIndex = (8|4|1) << 21, // pre-indexed addressing with writeback 196 PreIndex = (8|4|1) << 21, // pre-indexed addressing with writeback
208 PostIndex = (0|4|0) << 21, // post-indexed addressing with writeback 197 PostIndex = (0|4|0) << 21, // post-indexed addressing with writeback
209 NegOffset = (8|0|0) << 21, // negative offset (w/o writeback to base) 198 NegOffset = (8|0|0) << 21, // negative offset (w/o writeback to base)
210 NegPreIndex = (8|0|1) << 21, // negative pre-indexed with writeback 199 NegPreIndex = (8|0|1) << 21, // negative pre-indexed with writeback
211 NegPostIndex = (0|0|0) << 21 // negative post-indexed with writeback 200 NegPostIndex = (0|0|0) << 21 // negative post-indexed with writeback
212 }; 201 };
213 202
214 Address(const Address& other) : ValueObject(), encoding_(other.encoding_) { }
215
216 Address& operator=(const Address& other) {
217 encoding_ = other.encoding_;
218 return *this;
219 }
220
221 explicit Address(Register rn, int32_t offset = 0, Mode am = Offset) { 203 explicit Address(Register rn, int32_t offset = 0, Mode am = Offset) {
222 ASSERT(Utils::IsAbsoluteUint(12, offset)); 204 ASSERT(Utils::IsAbsoluteUint(12, offset));
223 if (offset < 0) { 205 if (offset < 0) {
224 encoding_ = (am ^ (1 << kUShift)) | -offset; // Flip U to adjust sign. 206 encoding_ = (am ^ (1 << kUShift)) | -offset; // Flip U to adjust sign.
225 } else { 207 } else {
226 encoding_ = am | offset; 208 encoding_ = am | offset;
227 } 209 }
228 encoding_ |= static_cast<uint32_t>(rn) << kRnShift; 210 encoding_ |= static_cast<uint32_t>(rn) << kRnShift;
229 } 211 }
230 212
(...skipping 12 matching lines...) Expand all
243 uint32_t encoding_; 225 uint32_t encoding_;
244 226
245 friend class Assembler; 227 friend class Assembler;
246 }; 228 };
247 229
248 230
249 class FieldAddress : public Address { 231 class FieldAddress : public Address {
250 public: 232 public:
251 FieldAddress(Register base, int32_t disp) 233 FieldAddress(Register base, int32_t disp)
252 : Address(base, disp - kHeapObjectTag) { } 234 : Address(base, disp - kHeapObjectTag) { }
253
254 FieldAddress(const FieldAddress& other) : Address(other) { }
255
256 FieldAddress& operator=(const FieldAddress& other) {
257 Address::operator=(other);
258 return *this;
259 }
260 }; 235 };
261 236
262 237
263 class Assembler : public ValueObject { 238 class Assembler : public ValueObject {
264 public: 239 public:
265 Assembler() 240 Assembler()
266 : buffer_(), 241 : buffer_(),
267 object_pool_(GrowableObjectArray::Handle()), 242 object_pool_(GrowableObjectArray::Handle()),
268 prologue_offset_(-1), 243 prologue_offset_(-1),
269 comments_() { } 244 comments_() { }
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 static int32_t EncodeBranchOffset(int offset, int32_t inst); 606 static int32_t EncodeBranchOffset(int offset, int32_t inst);
632 static int DecodeBranchOffset(int32_t inst); 607 static int DecodeBranchOffset(int32_t inst);
633 int32_t EncodeTstOffset(int offset, int32_t inst); 608 int32_t EncodeTstOffset(int offset, int32_t inst);
634 int DecodeTstOffset(int32_t inst); 609 int DecodeTstOffset(int32_t inst);
635 610
636 // Returns whether or not the given register is used for passing parameters. 611 // Returns whether or not the given register is used for passing parameters.
637 static int RegisterCompare(const Register* reg1, const Register* reg2) { 612 static int RegisterCompare(const Register* reg1, const Register* reg2) {
638 return *reg1 - *reg2; 613 return *reg1 - *reg2;
639 } 614 }
640 615
641 DISALLOW_ALLOCATION();
642 DISALLOW_COPY_AND_ASSIGN(Assembler); 616 DISALLOW_COPY_AND_ASSIGN(Assembler);
643 }; 617 };
644 618
645 } // namespace dart 619 } // namespace dart
646 620
647 #endif // VM_ASSEMBLER_ARM_H_ 621 #endif // VM_ASSEMBLER_ARM_H_
OLDNEW
« no previous file with comments | « runtime/vm/assembler.h ('k') | runtime/vm/assembler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698