| 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 are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // 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 3222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3233 // 1: ori(rd, rd, (j.imm64_ >> 16) & kImm16Mask); | 3233 // 1: ori(rd, rd, (j.imm64_ >> 16) & kImm16Mask); |
| 3234 // 2: dsll(rd, rd, 16); | 3234 // 2: dsll(rd, rd, 16); |
| 3235 // 3: ori(rd, rd, j.imm32_ & kImm16Mask); | 3235 // 3: ori(rd, rd, j.imm32_ & kImm16Mask); |
| 3236 // | 3236 // |
| 3237 // Patching the address must replace all the lui & ori instructions, | 3237 // Patching the address must replace all the lui & ori instructions, |
| 3238 // and flush the i-cache. | 3238 // and flush the i-cache. |
| 3239 // | 3239 // |
| 3240 // There is an optimization below, which emits a nop when the address | 3240 // There is an optimization below, which emits a nop when the address |
| 3241 // fits in just 16 bits. This is unlikely to help, and should be benchmarked, | 3241 // fits in just 16 bits. This is unlikely to help, and should be benchmarked, |
| 3242 // and possibly removed. | 3242 // and possibly removed. |
| 3243 void Assembler::set_target_address_at(Address pc, | 3243 void Assembler::set_target_address_at(Isolate* isolate, Address pc, |
| 3244 Address target, | 3244 Address target, |
| 3245 ICacheFlushMode icache_flush_mode) { | 3245 ICacheFlushMode icache_flush_mode) { |
| 3246 // There is an optimization where only 4 instructions are used to load address | 3246 // There is an optimization where only 4 instructions are used to load address |
| 3247 // in code on MIP64 because only 48-bits of address is effectively used. | 3247 // in code on MIP64 because only 48-bits of address is effectively used. |
| 3248 // It relies on fact the upper [63:48] bits are not used for virtual address | 3248 // It relies on fact the upper [63:48] bits are not used for virtual address |
| 3249 // translation and they have to be set according to value of bit 47 in order | 3249 // translation and they have to be set according to value of bit 47 in order |
| 3250 // get canonical address. | 3250 // get canonical address. |
| 3251 Instr instr1 = instr_at(pc + kInstrSize); | 3251 Instr instr1 = instr_at(pc + kInstrSize); |
| 3252 uint32_t rt_code = GetRt(instr1); | 3252 uint32_t rt_code = GetRt(instr1); |
| 3253 uint32_t* p = reinterpret_cast<uint32_t*>(pc); | 3253 uint32_t* p = reinterpret_cast<uint32_t*>(pc); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3266 // ori rt, rt, lower-16. | 3266 // ori rt, rt, lower-16. |
| 3267 // dsll rt, rt, 16. | 3267 // dsll rt, rt, 16. |
| 3268 // ori rt rt, lower-16. | 3268 // ori rt rt, lower-16. |
| 3269 *p = LUI | (rt_code << kRtShift) | ((itarget >> 32) & kImm16Mask); | 3269 *p = LUI | (rt_code << kRtShift) | ((itarget >> 32) & kImm16Mask); |
| 3270 *(p + 1) = ORI | (rt_code << kRtShift) | (rt_code << kRsShift) | 3270 *(p + 1) = ORI | (rt_code << kRtShift) | (rt_code << kRsShift) |
| 3271 | ((itarget >> 16) & kImm16Mask); | 3271 | ((itarget >> 16) & kImm16Mask); |
| 3272 *(p + 3) = ORI | (rt_code << kRsShift) | (rt_code << kRtShift) | 3272 *(p + 3) = ORI | (rt_code << kRsShift) | (rt_code << kRtShift) |
| 3273 | (itarget & kImm16Mask); | 3273 | (itarget & kImm16Mask); |
| 3274 | 3274 |
| 3275 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 3275 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
| 3276 Assembler::FlushICacheWithoutIsolate(pc, 4 * Assembler::kInstrSize); | 3276 Assembler::FlushICache(isolate, pc, 4 * Assembler::kInstrSize); |
| 3277 } | 3277 } |
| 3278 } | 3278 } |
| 3279 | 3279 |
| 3280 | 3280 |
| 3281 } // namespace internal | 3281 } // namespace internal |
| 3282 } // namespace v8 | 3282 } // namespace v8 |
| 3283 | 3283 |
| 3284 #endif // V8_TARGET_ARCH_MIPS64 | 3284 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |