| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 207 } |
| 208 | 208 |
| 209 | 209 |
| 210 void Assembler::emit(Instr x) { | 210 void Assembler::emit(Instr x) { |
| 211 CheckBuffer(); | 211 CheckBuffer(); |
| 212 *reinterpret_cast<Instr*>(pc_) = x; | 212 *reinterpret_cast<Instr*>(pc_) = x; |
| 213 pc_ += kInstrSize; | 213 pc_ += kInstrSize; |
| 214 } | 214 } |
| 215 | 215 |
| 216 | 216 |
| 217 void Assembler::emit_int32(int32_t x) { |
| 218 CheckBuffer(); |
| 219 *reinterpret_cast<int32_t*>(pc_) = x; |
| 220 pc_ += sizeof(int32_t); |
| 221 } |
| 222 |
| 223 |
| 217 Address Assembler::target_address_address_at(Address pc) { | 224 Address Assembler::target_address_address_at(Address pc) { |
| 218 Address target_pc = pc; | 225 Address target_pc = pc; |
| 219 Instr instr = Memory::int32_at(target_pc); | 226 Instr instr = Memory::int32_at(target_pc); |
| 220 // If we have a bx instruction, the instruction before the bx is | 227 // If we have a bx instruction, the instruction before the bx is |
| 221 // what we need to patch. | 228 // what we need to patch. |
| 222 static const int32_t kBxInstMask = 0x0ffffff0; | 229 static const int32_t kBxInstMask = 0x0ffffff0; |
| 223 static const int32_t kBxInstPattern = 0x012fff10; | 230 static const int32_t kBxInstPattern = 0x012fff10; |
| 224 if ((instr & kBxInstMask) == kBxInstPattern) { | 231 if ((instr & kBxInstMask) == kBxInstPattern) { |
| 225 target_pc -= kInstrSize; | 232 target_pc -= kInstrSize; |
| 226 instr = Memory::int32_at(target_pc); | 233 instr = Memory::int32_at(target_pc); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 254 // CPU::FlushICache(pc, sizeof(target)); | 261 // CPU::FlushICache(pc, sizeof(target)); |
| 255 // However, on ARM, no instruction was actually patched by the assignment | 262 // However, on ARM, no instruction was actually patched by the assignment |
| 256 // above; the target address is not part of an instruction, it is patched in | 263 // above; the target address is not part of an instruction, it is patched in |
| 257 // the constant pool and is read via a data access; the instruction accessing | 264 // the constant pool and is read via a data access; the instruction accessing |
| 258 // this address in the constant pool remains unchanged. | 265 // this address in the constant pool remains unchanged. |
| 259 } | 266 } |
| 260 | 267 |
| 261 } } // namespace v8::internal | 268 } } // namespace v8::internal |
| 262 | 269 |
| 263 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ | 270 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ |
| OLD | NEW |