Chromium Code Reviews| Index: src/assembler_ia32.h |
| diff --git a/src/assembler_ia32.h b/src/assembler_ia32.h |
| index 6ad8faebbd32594e9a32183f344c3eb6427cc824..1fd8301e0adcaaa632ebdc3b299cd37225181884 100644 |
| --- a/src/assembler_ia32.h |
| +++ b/src/assembler_ia32.h |
| @@ -45,6 +45,9 @@ const int MAX_NOP_SIZE = 8; |
| enum ScaleFactor { TIMES_1 = 0, TIMES_2 = 1, TIMES_4 = 2, TIMES_8 = 3 }; |
| class DisplacementRelocation : public AssemblerFixup { |
| + DisplacementRelocation(const DisplacementRelocation &) = delete; |
| + DisplacementRelocation &operator=(const DisplacementRelocation &) = delete; |
| + |
| public: |
| static DisplacementRelocation *create(Assembler *Asm, FixupKind Kind, |
| const ConstantRelocatable *Sym) { |
| @@ -61,17 +64,15 @@ public: |
| private: |
| DisplacementRelocation(FixupKind Kind, const ConstantRelocatable *Sym) |
| : AssemblerFixup(Kind, Sym) {} |
| - DisplacementRelocation(const DisplacementRelocation &) = delete; |
| - DisplacementRelocation &operator=(const DisplacementRelocation &) = delete; |
| }; |
| class Immediate { |
| + Immediate(const Immediate &) = delete; |
| + Immediate &operator=(const Immediate &) = delete; |
| + |
| public: |
| explicit Immediate(int32_t value) : value_(value), fixup_(NULL) {} |
| - explicit Immediate(const Immediate &other) |
| - : value_(other.value_), fixup_(other.fixup_) {} |
| - |
| explicit Immediate(AssemblerFixup *fixup) |
| : value_(fixup->value()->getOffset()), fixup_(fixup) { |
| // Use the Offset in the "value" for now. If the symbol is part of |
| @@ -98,6 +99,17 @@ private: |
| class Operand { |
| public: |
| + Operand(const Operand &other) : length_(other.length_), fixup_(other.fixup_) { |
|
Karl
2014/10/16 17:23:26
Jim suggested doing
// Operand(const Operand
Jim Stichnoth
2014/10/16 18:19:53
True, but here we're explicitly not using the defa
jvoung (off chromium)
2014/10/16 19:02:37
Right, it doesn't quite need to memmove everything
|
| + memmove(&encoding_[0], &other.encoding_[0], other.length_); |
| + } |
| + |
| + Operand &operator=(const Operand &other) { |
| + length_ = other.length_; |
| + fixup_ = other.fixup_; |
| + memmove(&encoding_[0], &other.encoding_[0], other.length_); |
| + return *this; |
| + } |
| + |
| uint8_t mod() const { return (encoding_at(0) >> 6) & 3; } |
| GPRRegister rm() const { |
| @@ -128,17 +140,6 @@ public: |
| AssemblerFixup *fixup() const { return fixup_; } |
| - Operand(const Operand &other) : length_(other.length_), fixup_(other.fixup_) { |
| - memmove(&encoding_[0], &other.encoding_[0], other.length_); |
| - } |
| - |
| - Operand &operator=(const Operand &other) { |
| - length_ = other.length_; |
| - fixup_ = other.fixup_; |
| - memmove(&encoding_[0], &other.encoding_[0], other.length_); |
| - return *this; |
| - } |
| - |
| protected: |
| Operand() : length_(0), fixup_(NULL) {} // Needed by subclass Address. |
| @@ -194,6 +195,13 @@ private: |
| class Address : public Operand { |
| public: |
| + Address(const Address &other) : Operand(other) {} |
| + |
| + Address &operator=(const Address &other) { |
| + Operand::operator=(other); |
| + return *this; |
| + } |
| + |
| Address(GPRRegister base, int32_t disp) { |
| if (disp == 0 && base != RegX8632::Encoded_Reg_ebp) { |
| SetModRM(0, base); |
| @@ -236,13 +244,6 @@ public: |
| } |
| } |
| - Address(const Address &other) : Operand(other) {} |
| - |
| - Address &operator=(const Address &other) { |
| - Operand::operator=(other); |
| - return *this; |
| - } |
| - |
| static Address Absolute(const uintptr_t addr) { |
| Address result; |
| result.SetModRM(0, RegX8632::Encoded_Reg_ebp); |
| @@ -270,6 +271,9 @@ private: |
| }; |
| class Label { |
| + Label(const Label &) = delete; |
| + Label &operator=(const Label &) = delete; |
| + |
| public: |
| Label() : position_(0), num_unresolved_(0) { |
| #ifdef DEBUG |
| @@ -346,11 +350,12 @@ private: |
| intptr_t unresolved_near_positions_[kMaxUnresolvedBranches]; |
| friend class AssemblerX86; |
| - Label(const Label &) = delete; |
| - Label &operator=(const Label &) = delete; |
| }; |
| class AssemblerX86 : public Assembler { |
| + AssemblerX86(const AssemblerX86 &) = delete; |
| + AssemblerX86 &operator=(const AssemblerX86 &) = delete; |
| + |
| public: |
| explicit AssemblerX86(bool use_far_branches = false) : buffer_(*this) { |
| // This mode is only needed and implemented for MIPS and ARM. |
| @@ -843,9 +848,6 @@ private: |
| GPRRegister shifter); |
| AssemblerBuffer buffer_; |
| - |
| - AssemblerX86(const AssemblerX86 &) = delete; |
| - AssemblerX86 &operator=(const AssemblerX86 &) = delete; |
| }; |
| inline void AssemblerX86::EmitUint8(uint8_t value) { |