| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // mov lr, pc | 157 // mov lr, pc |
| 158 // ldr pc, [pc, #-4] | 158 // ldr pc, [pc, #-4] |
| 159 return (current_instr == kMovLrPc) | 159 return (current_instr == kMovLrPc) |
| 160 && ((next_instr & kLdrPCMask) == kLdrPCPattern); | 160 && ((next_instr & kLdrPCMask) == kLdrPCPattern); |
| 161 #endif | 161 #endif |
| 162 } | 162 } |
| 163 | 163 |
| 164 | 164 |
| 165 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { | 165 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { |
| 166 Instr current_instr = Assembler::instr_at(pc_); | 166 Instr current_instr = Assembler::instr_at(pc_); |
| 167 return !Assembler::IsNop(current_instr, 2); | 167 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP); |
| 168 } | 168 } |
| 169 | 169 |
| 170 | 170 |
| 171 void RelocInfo::Visit(ObjectVisitor* visitor) { | 171 void RelocInfo::Visit(ObjectVisitor* visitor) { |
| 172 RelocInfo::Mode mode = rmode(); | 172 RelocInfo::Mode mode = rmode(); |
| 173 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 173 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 174 visitor->VisitPointer(target_object_address()); | 174 visitor->VisitPointer(target_object_address()); |
| 175 } else if (RelocInfo::IsCodeTarget(mode)) { | 175 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 176 visitor->VisitCodeTarget(this); | 176 visitor->VisitCodeTarget(this); |
| 177 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 177 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 281 |
| 282 #ifdef USE_BLX | 282 #ifdef USE_BLX |
| 283 // If we have a blx instruction, the instruction before it is | 283 // If we have a blx instruction, the instruction before it is |
| 284 // what needs to be patched. | 284 // what needs to be patched. |
| 285 if ((instr & kBlxRegMask) == kBlxRegPattern) { | 285 if ((instr & kBlxRegMask) == kBlxRegPattern) { |
| 286 target_pc -= kInstrSize; | 286 target_pc -= kInstrSize; |
| 287 instr = Memory::int32_at(target_pc); | 287 instr = Memory::int32_at(target_pc); |
| 288 } | 288 } |
| 289 #endif | 289 #endif |
| 290 | 290 |
| 291 // Verify that the instruction to patch is a | 291 ASSERT(IsLdrPcImmediateOffset(instr)); |
| 292 // ldr<cond> <Rd>, [pc +/- offset_12]. | |
| 293 ASSERT((instr & 0x0f7f0000) == 0x051f0000); | |
| 294 int offset = instr & 0xfff; // offset_12 is unsigned | 292 int offset = instr & 0xfff; // offset_12 is unsigned |
| 295 if ((instr & (1 << 23)) == 0) offset = -offset; // U bit defines offset sign | 293 if ((instr & (1 << 23)) == 0) offset = -offset; // U bit defines offset sign |
| 296 // Verify that the constant pool comes after the instruction referencing it. | 294 // Verify that the constant pool comes after the instruction referencing it. |
| 297 ASSERT(offset >= -4); | 295 ASSERT(offset >= -4); |
| 298 return target_pc + offset + 8; | 296 return target_pc + offset + 8; |
| 299 } | 297 } |
| 300 | 298 |
| 301 | 299 |
| 302 Address Assembler::target_address_at(Address pc) { | 300 Address Assembler::target_address_at(Address pc) { |
| 303 return Memory::Address_at(target_address_address_at(pc)); | 301 return Memory::Address_at(target_address_address_at(pc)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 317 // CPU::FlushICache(pc, sizeof(target)); | 315 // CPU::FlushICache(pc, sizeof(target)); |
| 318 // However, on ARM, no instruction was actually patched by the assignment | 316 // However, on ARM, no instruction was actually patched by the assignment |
| 319 // above; the target address is not part of an instruction, it is patched in | 317 // above; the target address is not part of an instruction, it is patched in |
| 320 // the constant pool and is read via a data access; the instruction accessing | 318 // the constant pool and is read via a data access; the instruction accessing |
| 321 // this address in the constant pool remains unchanged. | 319 // this address in the constant pool remains unchanged. |
| 322 } | 320 } |
| 323 | 321 |
| 324 } } // namespace v8::internal | 322 } } // namespace v8::internal |
| 325 | 323 |
| 326 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ | 324 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ |
| OLD | NEW |