| OLD | NEW |
| 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_MIPS_H_ | 5 #ifndef VM_ASSEMBLER_MIPS_H_ |
| 6 #define VM_ASSEMBLER_MIPS_H_ | 6 #define VM_ASSEMBLER_MIPS_H_ |
| 7 | 7 |
| 8 #ifndef VM_ASSEMBLER_H_ | 8 #ifndef VM_ASSEMBLER_H_ |
| 9 #error Do not include assembler_mips.h directly; use assembler.h instead. | 9 #error Do not include assembler_mips.h directly; use assembler.h instead. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "platform/assert.h" | 12 #include "platform/assert.h" |
| 13 #include "platform/utils.h" | 13 #include "platform/utils.h" |
| 14 #include "vm/constants_mips.h" | 14 #include "vm/constants_mips.h" |
| 15 #include "vm/locations.h" |
| 15 #include "vm/simulator.h" | 16 #include "vm/simulator.h" |
| 16 | 17 |
| 17 // References to documentation in this file refer to: | 18 // References to documentation in this file refer to: |
| 18 // "MIPS® Architecture For Programmers Volume I-A: | 19 // "MIPS® Architecture For Programmers Volume I-A: |
| 19 // Introduction to the MIPS32® Architecture" in short "VolI-A" | 20 // Introduction to the MIPS32® Architecture" in short "VolI-A" |
| 20 // and | 21 // and |
| 21 // "MIPS® Architecture For Programmers Volume II-A: | 22 // "MIPS® Architecture For Programmers Volume II-A: |
| 22 // The MIPS32® Instruction Set" in short "VolII-A" | 23 // The MIPS32® Instruction Set" in short "VolII-A" |
| 23 namespace dart { | 24 namespace dart { |
| 24 | 25 |
| 25 // Forward declarations. | 26 // Forward declarations. |
| 26 class RuntimeEntry; | 27 class RuntimeEntry; |
| 28 class Location; |
| 27 | 29 |
| 28 class Immediate : public ValueObject { | 30 class Immediate : public ValueObject { |
| 29 public: | 31 public: |
| 30 explicit Immediate(int32_t value) : value_(value) { } | 32 explicit Immediate(int32_t value) : value_(value) { } |
| 31 | 33 |
| 32 Immediate(const Immediate& other) : ValueObject(), value_(other.value_) { } | 34 Immediate(const Immediate& other) : ValueObject(), value_(other.value_) { } |
| 33 Immediate& operator=(const Immediate& other) { | 35 Immediate& operator=(const Immediate& other) { |
| 34 value_ = other.value_; | 36 value_ = other.value_; |
| 35 return *this; | 37 return *this; |
| 36 } | 38 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 : ValueObject(), base_(base), offset_(offset) { } | 52 : ValueObject(), base_(base), offset_(offset) { } |
| 51 | 53 |
| 52 Address(const Address& other) | 54 Address(const Address& other) |
| 53 : ValueObject(), base_(other.base_), offset_(other.offset_) { } | 55 : ValueObject(), base_(other.base_), offset_(other.offset_) { } |
| 54 Address& operator=(const Address& other) { | 56 Address& operator=(const Address& other) { |
| 55 base_ = other.base_; | 57 base_ = other.base_; |
| 56 offset_ = other.offset_; | 58 offset_ = other.offset_; |
| 57 return *this; | 59 return *this; |
| 58 } | 60 } |
| 59 | 61 |
| 62 static Address StackSlotAddress(const Location &stack_slot); |
| 63 |
| 60 uint32_t encoding() const { | 64 uint32_t encoding() const { |
| 61 ASSERT(Utils::IsInt(kImmBits, offset_)); | 65 ASSERT(Utils::IsInt(kImmBits, offset_)); |
| 62 uint16_t imm_value = static_cast<uint16_t>(offset_); | 66 uint16_t imm_value = static_cast<uint16_t>(offset_); |
| 63 return (base_ << kRsShift) | imm_value; | 67 return (base_ << kRsShift) | imm_value; |
| 64 } | 68 } |
| 65 | 69 |
| 66 static bool CanHoldOffset(int32_t offset) { | 70 static bool CanHoldOffset(int32_t offset) { |
| 67 return Utils::IsInt(kImmBits, offset); | 71 return Utils::IsInt(kImmBits, offset); |
| 68 } | 72 } |
| 69 | 73 |
| 70 Register base() const { return base_; } | 74 Register base() const { return base_; } |
| 71 int32_t offset() const { return offset_; } | 75 int32_t offset() const { return offset_; } |
| 72 | 76 |
| 73 bool Equals(const Address& other) { | 77 bool Equals(const Address& other) const { |
| 74 return (base_ == other.base_) && (offset_ == other.offset_); | 78 return (base_ == other.base_) && (offset_ == other.offset_); |
| 75 } | 79 } |
| 76 | 80 |
| 77 private: | 81 private: |
| 78 Register base_; | 82 Register base_; |
| 79 int32_t offset_; | 83 int32_t offset_; |
| 80 }; | 84 }; |
| 81 | 85 |
| 82 | 86 |
| 83 class FieldAddress : public Address { | 87 class FieldAddress : public Address { |
| (...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 Register value, | 1257 Register value, |
| 1254 Label* no_update); | 1258 Label* no_update); |
| 1255 | 1259 |
| 1256 DISALLOW_ALLOCATION(); | 1260 DISALLOW_ALLOCATION(); |
| 1257 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1261 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 1258 }; | 1262 }; |
| 1259 | 1263 |
| 1260 } // namespace dart | 1264 } // namespace dart |
| 1261 | 1265 |
| 1262 #endif // VM_ASSEMBLER_MIPS_H_ | 1266 #endif // VM_ASSEMBLER_MIPS_H_ |
| OLD | NEW |