| 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 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 in_delay_slot_(false), | 151 in_delay_slot_(false), |
| 152 comments_() { } | 152 comments_() { } |
| 153 ~Assembler() { } | 153 ~Assembler() { } |
| 154 | 154 |
| 155 void PopRegister(Register r) { Pop(r); } | 155 void PopRegister(Register r) { Pop(r); } |
| 156 | 156 |
| 157 void Bind(Label* label); | 157 void Bind(Label* label); |
| 158 | 158 |
| 159 // Misc. functionality | 159 // Misc. functionality |
| 160 int CodeSize() const { return buffer_.Size(); } | 160 int CodeSize() const { return buffer_.Size(); } |
| 161 int prologue_offset() const { return -1; } | 161 int prologue_offset() const { return prologue_offset_; } |
| 162 const ZoneGrowableArray<int>& GetPointerOffsets() const { | 162 const ZoneGrowableArray<int>& GetPointerOffsets() const { |
| 163 return buffer_.pointer_offsets(); | 163 return buffer_.pointer_offsets(); |
| 164 } | 164 } |
| 165 const GrowableObjectArray& object_pool() const { return object_pool_; } | 165 const GrowableObjectArray& object_pool() const { return object_pool_; } |
| 166 void FinalizeInstructions(const MemoryRegion& region) { | 166 void FinalizeInstructions(const MemoryRegion& region) { |
| 167 buffer_.FinalizeInstructions(region); | 167 buffer_.FinalizeInstructions(region); |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Set up a stub frame so that the stack traversal code can easily identify | 170 // Set up a stub frame so that the stack traversal code can easily identify |
| 171 // a stub frame. | 171 // a stub frame. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 198 void Unimplemented(const char* message); | 198 void Unimplemented(const char* message); |
| 199 void Untested(const char* message); | 199 void Untested(const char* message); |
| 200 void Unreachable(const char* message); | 200 void Unreachable(const char* message); |
| 201 | 201 |
| 202 static void InitializeMemoryWithBreakpoints(uword data, int length); | 202 static void InitializeMemoryWithBreakpoints(uword data, int length); |
| 203 | 203 |
| 204 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 204 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
| 205 | 205 |
| 206 const Code::Comments& GetCodeComments() const; | 206 const Code::Comments& GetCodeComments() const; |
| 207 | 207 |
| 208 static const char* RegisterName(Register reg) { | 208 static const char* RegisterName(Register reg); |
| 209 UNIMPLEMENTED(); | |
| 210 return NULL; | |
| 211 } | |
| 212 | 209 |
| 213 static const char* FpuRegisterName(FpuRegister reg) { | 210 static const char* FpuRegisterName(FpuRegister reg); |
| 214 UNIMPLEMENTED(); | 211 |
| 215 return NULL; | 212 void SetPrologueOffset() { |
| 213 if (prologue_offset_ == -1) { |
| 214 prologue_offset_ = CodeSize(); |
| 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 // A utility to be able to assemble an instruction into the delay slot. | 218 // A utility to be able to assemble an instruction into the delay slot. |
| 219 Assembler* delay_slot() { | 219 Assembler* delay_slot() { |
| 220 ASSERT(delay_slot_available_); | 220 ASSERT(delay_slot_available_); |
| 221 ASSERT(buffer_.Load<int32_t>(buffer_.GetPosition() - sizeof(int32_t)) == | 221 ASSERT(buffer_.Load<int32_t>(buffer_.GetPosition() - sizeof(int32_t)) == |
| 222 Instr::kNopInstruction); | 222 Instr::kNopInstruction); |
| 223 buffer_.Remit<int32_t>(); | 223 buffer_.Remit<int32_t>(); |
| 224 delay_slot_available_ = false; | 224 delay_slot_available_ = false; |
| 225 in_delay_slot_ = true; | 225 in_delay_slot_ = true; |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 const int32_t ival = bit_cast<int32_t, float>(value); | 809 const int32_t ival = bit_cast<int32_t, float>(value); |
| 810 if (ival == 0) { | 810 if (ival == 0) { |
| 811 mtc1(ZR, rd); | 811 mtc1(ZR, rd); |
| 812 } else { | 812 } else { |
| 813 LoadImmediate(TMP1, ival); | 813 LoadImmediate(TMP1, ival); |
| 814 mtc1(TMP1, rd); | 814 mtc1(TMP1, rd); |
| 815 } | 815 } |
| 816 } | 816 } |
| 817 | 817 |
| 818 void AddImmediate(Register rd, Register rs, int32_t value) { | 818 void AddImmediate(Register rd, Register rs, int32_t value) { |
| 819 if (value == 0) return; | 819 if ((value == 0) && (rd == rs)) return; |
| 820 // If value is 0, we still want to move rs to rd if they aren't the same. |
| 820 if (Utils::IsInt(kImmBits, value)) { | 821 if (Utils::IsInt(kImmBits, value)) { |
| 821 addiu(rd, rs, Immediate(value)); | 822 addiu(rd, rs, Immediate(value)); |
| 822 } else { | 823 } else { |
| 823 LoadImmediate(TMP1, value); | 824 LoadImmediate(TMP1, value); |
| 824 addu(rd, rs, TMP1); | 825 addu(rd, rs, TMP1); |
| 825 } | 826 } |
| 826 } | 827 } |
| 827 | 828 |
| 828 void AddImmediate(Register rd, int32_t value) { | 829 void AddImmediate(Register rd, int32_t value) { |
| 829 AddImmediate(rd, rd, value); | 830 AddImmediate(rd, rd, value); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 Register value, | 1186 Register value, |
| 1186 Label* no_update); | 1187 Label* no_update); |
| 1187 | 1188 |
| 1188 DISALLOW_ALLOCATION(); | 1189 DISALLOW_ALLOCATION(); |
| 1189 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1190 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 1190 }; | 1191 }; |
| 1191 | 1192 |
| 1192 } // namespace dart | 1193 } // namespace dart |
| 1193 | 1194 |
| 1194 #endif // VM_ASSEMBLER_MIPS_H_ | 1195 #endif // VM_ASSEMBLER_MIPS_H_ |
| OLD | NEW |