Index: runtime/vm/assembler_ia32.h |
=================================================================== |
--- runtime/vm/assembler_ia32.h (revision 17160) |
+++ runtime/vm/assembler_ia32.h (working copy) |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
@@ -30,13 +30,11 @@ |
private: |
const int32_t value_; |
- |
- // TODO(5411081): Add DISALLOW_COPY_AND_ASSIGN(Immediate) once the mac |
- // build issue is resolved. |
+ DISALLOW_COPY_AND_ASSIGN(Immediate); |
srdjan
2013/01/16 23:57:56
Need to be fixed as discussed (Mac build complains
regis
2013/01/17 01:02:09
Done.
|
}; |
-class Operand : public ValueObject { |
+class Operand { |
public: |
uint8_t mod() const { |
return (encoding_at(0) >> 6) & 3; |
@@ -68,14 +66,18 @@ |
return bit_copy<int32_t>(encoding_[length_ - 4]); |
} |
- bool IsRegister(Register reg) const { |
- return ((encoding_[0] & 0xF8) == 0xC0) // Addressing mode is register only. |
- && ((encoding_[0] & 0x07) == reg); // Register codes match. |
+ Operand(const Operand& other) : length_(other.length_) { |
+ memmove(&encoding_[0], &other.encoding_[0], other.length_); |
} |
+ Operand& operator=(const Operand& other) { |
+ length_ = other.length_; |
+ memmove(&encoding_[0], &other.encoding_[0], other.length_); |
+ return *this; |
+ } |
+ |
protected: |
- // Operand can be sub classed (e.g: Address). |
- Operand() : length_(0) { } |
+ Operand() : length_(0) { } // Needed by subclass Address. |
void SetModRM(int mod, Register rm) { |
ASSERT((mod & ~3) == 0); |
@@ -115,10 +117,14 @@ |
return encoding_[index]; |
} |
+ // Returns whether or not this operand is really the given register in |
+ // disguise. Used from the assembler to generate better encodings. |
+ bool IsRegister(Register reg) const { |
+ return ((encoding_[0] & 0xF8) == 0xC0) // Addressing mode is register only. |
+ && ((encoding_[0] & 0x07) == reg); // Register codes match. |
+ } |
+ |
friend class Assembler; |
- |
- // TODO(5411081): Add DISALLOW_COPY_AND_ASSIGN(Operand) once the mac |
- // build issue is resolved. |
}; |
@@ -162,6 +168,13 @@ |
} |
} |
+ Address(const Address& other) : Operand(other) { } |
+ |
+ Address& operator=(const Address& other) { |
+ Operand::operator=(other); |
+ return *this; |
+ } |
+ |
static Address Absolute(const uword addr) { |
Address result; |
result.SetModRM(0, EBP); |
@@ -170,19 +183,24 @@ |
} |
private: |
- Address() {} |
- |
- // TODO(5411081): Add DISALLOW_COPY_AND_ASSIGN(Address) once the mac |
- // build issue is resolved. |
+ Address() { } // Needed by Address::Absolute. |
}; |
class FieldAddress : public Address { |
public: |
FieldAddress(Register base, int32_t disp) |
- : Address(base, disp - kHeapObjectTag) {} |
+ : Address(base, disp - kHeapObjectTag) { } |
+ |
FieldAddress(Register base, Register index, ScaleFactor scale, int32_t disp) |
- : Address(base, index, scale, disp - kHeapObjectTag) {} |
+ : Address(base, index, scale, disp - kHeapObjectTag) { } |
+ |
+ FieldAddress(const FieldAddress& other) : Address(other) { } |
+ |
+ FieldAddress& operator=(const FieldAddress& other) { |
+ Address::operator=(other); |
+ return *this; |
+ } |
}; |
@@ -636,7 +654,7 @@ |
const Code::Comments& GetCodeComments() const; |
static const char* RegisterName(Register reg); |
- static const char* XmmRegisterName(XmmRegister reg); |
+ static const char* FpuRegisterName(FpuRegister reg); |
private: |
AssemblerBuffer buffer_; |