OLD | NEW |
1 | 1 |
2 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 2 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
3 // All Rights Reserved. | 3 // All Rights Reserved. |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // - Redistributions of source code must retain the above copyright notice, | 9 // - Redistributions of source code must retain the above copyright notice, |
10 // this list of conditions and the following disclaimer. | 10 // this list of conditions and the following disclaimer. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 223 } |
224 | 224 |
225 | 225 |
226 Address RelocInfo::target_external_reference() { | 226 Address RelocInfo::target_external_reference() { |
227 DCHECK(rmode_ == EXTERNAL_REFERENCE); | 227 DCHECK(rmode_ == EXTERNAL_REFERENCE); |
228 return Assembler::target_address_at(pc_, host_); | 228 return Assembler::target_address_at(pc_, host_); |
229 } | 229 } |
230 | 230 |
231 | 231 |
232 Address RelocInfo::target_internal_reference() { | 232 Address RelocInfo::target_internal_reference() { |
233 DCHECK(rmode_ == INTERNAL_REFERENCE); | 233 if (rmode_ == INTERNAL_REFERENCE) { |
234 return Memory::Address_at(pc_); | 234 return Memory::Address_at(pc_); |
| 235 } else { |
| 236 DCHECK(rmode_ == INTERNAL_REFERENCE_ENCODED); |
| 237 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize); |
| 238 Instr instr_ori = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); |
| 239 Instr instr_ori2 = Assembler::instr_at(pc_ + 3 * Assembler::kInstrSize); |
| 240 DCHECK(Assembler::IsLui(instr_lui)); |
| 241 DCHECK(Assembler::IsOri(instr_ori)); |
| 242 DCHECK(Assembler::IsOri(instr_ori2)); |
| 243 int64_t imm = (instr_lui & static_cast<int64_t>(kImm16Mask)) << 32; |
| 244 imm |= (instr_ori & static_cast<int64_t>(kImm16Mask)) << 16; |
| 245 imm |= (instr_ori2 & static_cast<int64_t>(kImm16Mask)); |
| 246 return reinterpret_cast<Address>(imm); |
| 247 } |
235 } | 248 } |
236 | 249 |
237 | 250 |
238 void RelocInfo::set_target_internal_reference(Address target) { | 251 void RelocInfo::set_target_internal_reference(Address target) { |
239 DCHECK(rmode_ == INTERNAL_REFERENCE); | 252 if (rmode_ == INTERNAL_REFERENCE) { |
240 Memory::Address_at(pc_) = target; | 253 Memory::Address_at(pc_) = target; |
| 254 } else { |
| 255 // Encoded internal references are lui/ori load of 48-bit abolute address. |
| 256 DCHECK(rmode_ == INTERNAL_REFERENCE_ENCODED); |
| 257 Instr instr_lui = Assembler::instr_at(pc_ + 0 * Assembler::kInstrSize); |
| 258 Instr instr_ori = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); |
| 259 Instr instr_ori2 = Assembler::instr_at(pc_ + 3 * Assembler::kInstrSize); |
| 260 DCHECK(Assembler::IsLui(instr_lui)); |
| 261 DCHECK(Assembler::IsOri(instr_ori)); |
| 262 DCHECK(Assembler::IsOri(instr_ori2)); |
| 263 instr_lui &= ~kImm16Mask; |
| 264 instr_ori &= ~kImm16Mask; |
| 265 instr_ori2 &= ~kImm16Mask; |
| 266 int64_t imm = reinterpret_cast<int64_t>(target); |
| 267 DCHECK((imm & 3) == 0); |
| 268 Assembler::instr_at_put(pc_ + 0 * Assembler::kInstrSize, |
| 269 instr_lui | ((imm >> 32) & kImm16Mask)); |
| 270 Assembler::instr_at_put(pc_ + 1 * Assembler::kInstrSize, |
| 271 instr_ori | ((imm >> 16) & kImm16Mask)); |
| 272 Assembler::instr_at_put(pc_ + 3 * Assembler::kInstrSize, |
| 273 instr_ori | (imm & kImm16Mask)); |
| 274 // Currently used only by deserializer, and all code will be flushed |
| 275 // after complete deserialization, no need to flush on each reference. |
| 276 } |
241 } | 277 } |
242 | 278 |
243 | 279 |
244 Address RelocInfo::target_runtime_entry(Assembler* origin) { | 280 Address RelocInfo::target_runtime_entry(Assembler* origin) { |
245 DCHECK(IsRuntimeEntry(rmode_)); | 281 DCHECK(IsRuntimeEntry(rmode_)); |
246 return target_address(); | 282 return target_address(); |
247 } | 283 } |
248 | 284 |
249 | 285 |
250 void RelocInfo::set_target_runtime_entry(Address target, | 286 void RelocInfo::set_target_runtime_entry(Address target, |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 } | 501 } |
466 *reinterpret_cast<uint64_t*>(pc_) = x; | 502 *reinterpret_cast<uint64_t*>(pc_) = x; |
467 pc_ += kInstrSize * 2; | 503 pc_ += kInstrSize * 2; |
468 CheckTrampolinePoolQuick(); | 504 CheckTrampolinePoolQuick(); |
469 } | 505 } |
470 | 506 |
471 | 507 |
472 } } // namespace v8::internal | 508 } } // namespace v8::internal |
473 | 509 |
474 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 510 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
OLD | NEW |