| 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 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 EmitFarJump(offset, false); | 178 EmitFarJump(offset, false); |
| 179 } | 179 } |
| 180 | 180 |
| 181 | 181 |
| 182 void Assembler::EmitBranch(Opcode b, Register rs, Register rt, Label* label) { | 182 void Assembler::EmitBranch(Opcode b, Register rs, Register rt, Label* label) { |
| 183 if (label->IsBound()) { | 183 if (label->IsBound()) { |
| 184 // Relative destination from an instruction after the branch. | 184 // Relative destination from an instruction after the branch. |
| 185 const int32_t dest = | 185 const int32_t dest = |
| 186 label->Position() - (buffer_.Size() + Instr::kInstrSize); | 186 label->Position() - (buffer_.Size() + Instr::kInstrSize); |
| 187 if (use_far_branches() && !CanEncodeBranchOffset(dest)) { | 187 if (use_far_branches() && !CanEncodeBranchOffset(dest)) { |
| 188 EmitFarBranch(b, rs, rt, label->Position()); | 188 EmitFarBranch(OppositeBranchOpcode(b), rs, rt, label->Position()); |
| 189 } else { | 189 } else { |
| 190 const uint16_t dest_off = EncodeBranchOffset(dest, 0); | 190 const uint16_t dest_off = EncodeBranchOffset(dest, 0); |
| 191 EmitIType(b, rs, rt, dest_off); | 191 EmitIType(b, rs, rt, dest_off); |
| 192 } | 192 } |
| 193 } else { | 193 } else { |
| 194 const intptr_t position = buffer_.Size(); | 194 const intptr_t position = buffer_.Size(); |
| 195 if (use_far_branches()) { | 195 if (use_far_branches()) { |
| 196 const uint32_t dest_off = label->position_; | 196 const uint32_t dest_off = label->position_; |
| 197 EmitFarBranch(b, rs, rt, dest_off); | 197 EmitFarBranch(b, rs, rt, dest_off); |
| 198 } else { | 198 } else { |
| 199 const uint16_t dest_off = EncodeBranchOffset(label->position_, 0); | 199 const uint16_t dest_off = EncodeBranchOffset(label->position_, 0); |
| 200 EmitIType(b, rs, rt, dest_off); | 200 EmitIType(b, rs, rt, dest_off); |
| 201 } | 201 } |
| 202 label->LinkTo(position); | 202 label->LinkTo(position); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 | 206 |
| 207 void Assembler::EmitRegImmBranch(RtRegImm b, Register rs, Label* label) { | 207 void Assembler::EmitRegImmBranch(RtRegImm b, Register rs, Label* label) { |
| 208 if (label->IsBound()) { | 208 if (label->IsBound()) { |
| 209 // Relative destination from an instruction after the branch. | 209 // Relative destination from an instruction after the branch. |
| 210 const int32_t dest = | 210 const int32_t dest = |
| 211 label->Position() - (buffer_.Size() + Instr::kInstrSize); | 211 label->Position() - (buffer_.Size() + Instr::kInstrSize); |
| 212 if (use_far_branches() && !CanEncodeBranchOffset(dest)) { | 212 if (use_far_branches() && !CanEncodeBranchOffset(dest)) { |
| 213 EmitFarRegImmBranch(b, rs, label->Position()); | 213 EmitFarRegImmBranch(OppositeBranchNoLink(b), rs, label->Position()); |
| 214 } else { | 214 } else { |
| 215 const uint16_t dest_off = EncodeBranchOffset(dest, 0); | 215 const uint16_t dest_off = EncodeBranchOffset(dest, 0); |
| 216 EmitRegImmType(REGIMM, rs, b, dest_off); | 216 EmitRegImmType(REGIMM, rs, b, dest_off); |
| 217 } | 217 } |
| 218 } else { | 218 } else { |
| 219 const intptr_t position = buffer_.Size(); | 219 const intptr_t position = buffer_.Size(); |
| 220 if (use_far_branches()) { | 220 if (use_far_branches()) { |
| 221 const uint32_t dest_off = label->position_; | 221 const uint32_t dest_off = label->position_; |
| 222 EmitFarRegImmBranch(b, rs, dest_off); | 222 EmitFarRegImmBranch(b, rs, dest_off); |
| 223 } else { | 223 } else { |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 Emit(reinterpret_cast<int32_t>(message)); | 966 Emit(reinterpret_cast<int32_t>(message)); |
| 967 Bind(&msg); | 967 Bind(&msg); |
| 968 break_(Instr::kMsgMessageCode); | 968 break_(Instr::kMsgMessageCode); |
| 969 } | 969 } |
| 970 #endif | 970 #endif |
| 971 } | 971 } |
| 972 | 972 |
| 973 } // namespace dart | 973 } // namespace dart |
| 974 | 974 |
| 975 #endif // defined TARGET_ARCH_MIPS | 975 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |