| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 if (buffer_space() <= kGap) { | 215 if (buffer_space() <= kGap) { |
| 216 GrowBuffer(); | 216 GrowBuffer(); |
| 217 } | 217 } |
| 218 if (pc_offset() >= next_buffer_check_) { | 218 if (pc_offset() >= next_buffer_check_) { |
| 219 CheckConstPool(false, true); | 219 CheckConstPool(false, true); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 | 223 |
| 224 void Assembler::emit(Instr x) { | 224 void Assembler::emit(Instr x) { |
| 225 forceArmMode(); |
| 225 CheckBuffer(); | 226 CheckBuffer(); |
| 226 *reinterpret_cast<Instr*>(pc_) = x; | 227 *reinterpret_cast<Instr*>(pc_) = x; |
| 227 pc_ += kInstrSize; | 228 pc_ += kInstrSize; |
| 228 } | 229 } |
| 229 | 230 |
| 231 void Assembler::emitThumb(ThumbInstr x) { |
| 232 forceThumbMode(); |
| 233 CheckBuffer(); |
| 234 *reinterpret_cast<ThumbInstr*>(pc_) = x; |
| 235 pc_ += kThumbSize; |
| 236 } |
| 237 |
| 230 | 238 |
| 231 Address Assembler::target_address_address_at(Address pc) { | 239 Address Assembler::target_address_address_at(Address pc) { |
| 232 Instr instr = Memory::int32_at(pc); | 240 Instr instr = Memory::int32_at(pc); |
| 233 // Verify that the instruction at pc is a ldr<cond> <Rd>, [pc +/- offset_12]. | 241 // Verify that the instruction at pc is a ldr<cond> <Rd>, [pc +/- offset_12]. |
| 234 ASSERT((instr & 0x0f7f0000) == 0x051f0000); | 242 ASSERT((instr & 0x0f7f0000) == 0x051f0000); |
| 235 int offset = instr & 0xfff; // offset_12 is unsigned | 243 int offset = instr & 0xfff; // offset_12 is unsigned |
| 236 if ((instr & (1 << 23)) == 0) offset = -offset; // U bit defines offset sign | 244 if ((instr & (1 << 23)) == 0) offset = -offset; // U bit defines offset sign |
| 237 // Verify that the constant pool comes after the instruction referencing it. | 245 // Verify that the constant pool comes after the instruction referencing it. |
| 238 ASSERT(offset >= -4); | 246 ASSERT(offset >= -4); |
| 239 return pc + offset + 8; | 247 return pc + offset + 8; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 258 // CPU::FlushICache(pc, sizeof(target)); | 266 // CPU::FlushICache(pc, sizeof(target)); |
| 259 // However, on ARM, no instruction was actually patched by the assignment | 267 // However, on ARM, no instruction was actually patched by the assignment |
| 260 // above; the target address is not part of an instruction, it is patched in | 268 // above; the target address is not part of an instruction, it is patched in |
| 261 // the constant pool and is read via a data access; the instruction accessing | 269 // the constant pool and is read via a data access; the instruction accessing |
| 262 // this address in the constant pool remains unchanged. | 270 // this address in the constant pool remains unchanged. |
| 263 } | 271 } |
| 264 | 272 |
| 265 } } // namespace v8::internal | 273 } } // namespace v8::internal |
| 266 | 274 |
| 267 #endif // V8_ARM_ASSEMBLER_THUMB2_INL_H_ | 275 #endif // V8_ARM_ASSEMBLER_THUMB2_INL_H_ |
| OLD | NEW |