| 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" // Needed here to get TARGET_ARCH_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/constants_mips.h" | 8 #include "vm/constants_mips.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/instructions.h" | 10 #include "vm/instructions.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 lui->SetImmInstrBits(LUI, ZR, TMP1, target_hi); | 170 lui->SetImmInstrBits(LUI, ZR, TMP1, target_hi); |
| 171 ori->SetImmInstrBits(ORI, TMP1, TMP1, target_lo); | 171 ori->SetImmInstrBits(ORI, TMP1, TMP1, target_lo); |
| 172 jr->SetSpecialInstrBits(JALR, TMP1, ZR, RA); | 172 jr->SetSpecialInstrBits(JALR, TMP1, ZR, RA); |
| 173 nop->SetInstructionBits(Instr::kNopInstruction); | 173 nop->SetInstructionBits(Instr::kNopInstruction); |
| 174 | 174 |
| 175 ASSERT(kFixedLengthInBytes == 4 * Instr::kInstrSize); | 175 ASSERT(kFixedLengthInBytes == 4 * Instr::kInstrSize); |
| 176 CPU::FlushICache(pc, kFixedLengthInBytes); | 176 CPU::FlushICache(pc, kFixedLengthInBytes); |
| 177 } | 177 } |
| 178 | 178 |
| 179 | 179 |
| 180 JumpPattern::JumpPattern(uword pc) : pc_(pc) { } | 180 JumpPattern::JumpPattern(uword pc, const Code& code) : pc_(pc) { } |
| 181 | 181 |
| 182 | 182 |
| 183 bool JumpPattern::IsValid() const { | 183 bool JumpPattern::IsValid() const { |
| 184 Instr* lui = Instr::At(pc_ + (0 * Instr::kInstrSize)); | 184 Instr* lui = Instr::At(pc_ + (0 * Instr::kInstrSize)); |
| 185 Instr* ori = Instr::At(pc_ + (1 * Instr::kInstrSize)); | 185 Instr* ori = Instr::At(pc_ + (1 * Instr::kInstrSize)); |
| 186 Instr* jr = Instr::At(pc_ + (2 * Instr::kInstrSize)); | 186 Instr* jr = Instr::At(pc_ + (2 * Instr::kInstrSize)); |
| 187 Instr* nop = Instr::At(pc_ + (3 * Instr::kInstrSize)); | 187 Instr* nop = Instr::At(pc_ + (3 * Instr::kInstrSize)); |
| 188 return (lui->OpcodeField() == LUI) && | 188 return (lui->OpcodeField() == LUI) && |
| 189 (ori->OpcodeField() == ORI) && | 189 (ori->OpcodeField() == ORI) && |
| 190 (jr->OpcodeField() == SPECIAL) && | 190 (jr->OpcodeField() == SPECIAL) && |
| (...skipping 20 matching lines...) Expand all Loading... |
| 211 const uint16_t target_hi = target_address >> 16; | 211 const uint16_t target_hi = target_address >> 16; |
| 212 | 212 |
| 213 lui->SetInstructionBits((lui_bits & 0xffff0000) | target_hi); | 213 lui->SetInstructionBits((lui_bits & 0xffff0000) | target_hi); |
| 214 ori->SetInstructionBits((ori_bits & 0xffff0000) | target_lo); | 214 ori->SetInstructionBits((ori_bits & 0xffff0000) | target_lo); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace dart | 217 } // namespace dart |
| 218 | 218 |
| 219 #endif // defined TARGET_ARCH_MIPS | 219 #endif // defined TARGET_ARCH_MIPS |
| 220 | 220 |
| OLD | NEW |